If I use Finder's ⌘K shortcut, I can mount SMB shares as my normal MacOS user. A mount point is created in /Volumes, and the mount point will be owned by the user I'm logged in as.
But there are limitations to this approach. One limitation is that Finder will only let you use one account on the remote system. In other words, If I have access to two home directories under different accounts on the same SMB server, I can't mount them both with Finder.
But I can mount them both from the command line. The command is:
mount -t smbfs //user@host/target mount-point
You should be able to just run this command as your normal user and the resulting mount would be owned by that user. Someone claims success doing this here.
Someone else had the same problem as me, but with a different error, here. The solutions provided then don't work now.
And all of this works fine when mounting a share being served by Windows.
But if I want to mount a share being served by Samba, I have to either be logged in as root (in which case the mount will succeed but the filesystem will be owned by root), or I have to use Finder.
If I run mount
as my normal user, the error I depends on if the mount point exists or not.
If it does:
macbook:~ user$ mount -t smbfs //user@linuxhost/remote-path local-path
Password for host:
mount_smbfs: mount error: /Users/user/local-path: File exists
mount: /Users/user/local-path failed with 64
If it doesn't:
macbook:~ user$ rmdir local-path
macbook:~ user$ mount -t smbfs //user@linuxhost/remote-path local-path
mount: realpath /Users/user/local-path: No such file or directory
The File exists
error is not caused by the SMB share already being mounted.
What difference between Samba and Windows might mount_smbfs
be picking up on that triggers this problem?