SMB Share Permissions for Admin

Hi,

I have a script that renames a file on a network share. If the share is mounted via afp, it works as expected. But when it’s mounted using smb, a prompt appears reading “Finder.app wants to make changes, Type your password to allow this.”

In both cases, the script is run under an Admin account and in both cases the drive is mounted with an Admin user on the file server.

I can drag files in and out of the share, so I have write access.

How can I make it not do this? Is there some extra security thing under smb shares?

Below is the script (obviously it really does more than this, but this is what I’ve reduced it to trying to debug this issue).

Thanks,

Jeff

tell application "Finder"
	try
		set fil to file "KIP Scans:default.pdf"
		if exists (fil) then
			set nn to "newname.pdf"
			set name of fil to nn
		end if
	end try
end tell

Model: VM, 10.11.6
AppleScript: 2.5
Browser: Firefox 52.0
Operating System: Mac OS X (10.10)

Finder is an old beast.

Try to do the same with “System Events”.

tell application "System Events"
	try
		set fil to "KIP Scans:default.pdf"
		if exists (disk item fil) then
			set nn to "newname.pdf"
			set name of disk item fil to nn
		end if
	end try
end tell

Yvan KOENIG running Sierra 10.12.4 in French (VALLAURIS, France) mardi 4 avril 2017 14:21:40

Thanks Yvan.

It does not prompt for credentials, but it doesn’t rename the file either. No error is thrown (even without the try block); the file name just doesn’t change.

Thanks,

Jeff

I have no practice of networks but I am surprised.

It does the job when applied on a local volume.

Yvan KOENIG running Sierra 10.12.4 in French (VALLAURIS, France) mardi 4 avril 2017 15:46:25

Network share file permissions and OSX can be a nightmare and a half.

I’ve had to deal with issues pretty extensively, and I’m going to guess that it really is a permission setting difference server-side. So to test that theory, does it work to perform the same change manually in the Finder when the drive is mounted by SMB?

If the answer’s “no,” then you don’t really have a scripting question, you have a permissions question. Your best bet is probably to head over to a forum dedicated to your NAS or to Superuser or somewhere and post the question as “why do I have permissions to make changes to this file when connected via AFP but not via SMB?”

One possibility there is that on your NAS, UNIX permissions override ACL’s via one protocol but not the other, and the user has permissions via one but not the other. Or there are a lot of other possible causes.

If you can make the change manually but not by scripting, then let us know and we’ll take another crack at it here.

I finally surrendered and rewrote it to run on the file server itself, where everything is local and it’s working fine. Still, it gives me (more) pause as to how serious Apple is about adopting SMB when it’s still this wonky. Ah well.

Thanks all for the advice and tips!

Jeff