How to mount SMB share that can be accessed by anyone on Mac OS X El Capitan
Make the SMB share mountable as guest, then it will be mounted with right permissions.
I had the exact same problem and this works for me in High Sierra:
/etc/auto_nfs:
Public -fstype=smbfs,soft,noowners,noatime,nosuid smb://[email protected]/Public
And after mount, it will have drwxrwxrwx rights and I am able to browse it from different users.
It seems like macOS does not allow users to mount SMB network drive with custom uid/gid bits. And it only permits a user who mounts a drive to access the drive. I do not know whether Apple cares about security or it is just a bug. But unfortunately, it is for years. I have tested several cases on a macOS-to-macOS shared drive:
known-user@a-server:~% sudo ls -l
-rw-r----- 1 known-user known-group 0 Jun 13 10:50 a-file
-rw-r----- 1 known-user unknown-group 0 Jun 13 10:50 b-file
-rw-r----- 1 unknown-user known-group 0 Jun 13 10:50 c-file
-rw-r----- 1 unknown-user unknown-group 0 Jun 13 10:50 b-file
who-mount@my-desktop:~% sudo ls -l
-rw-r----- 1 who-mount whose-group 0 Jun 13 10:50 a-file
-rw-r----- 1 who-mount whose-group 0 Jun 13 10:50 b-file
-rw-r----- 1 who-mount whose-group 0 Jun 13 10:50 c-file
-rw-r----- 1 who-mount whose-group 0 Jun 13 10:50 d-file
who-mount@my-desktop:~% cat a-file
who-mount@my-desktop:~% echo hello > a-file
who-mount@my-desktop:~% cat b-file
who-mount@my-desktop:~% echo hello > b-file
who-mount@my-desktop:~% cat c-file
who-mount@my-desktop:~% echo hello > c-file
zsh: permission denied: c-file
who-mount@my-desktop:~% cat d-file
cat: d-file: Permission denied
who-mount@my-desktop:~% echo hello > d-file
zsh: permission denied: d-file
- The uid/gid of shared files/folders are always
who-mount:whose-group
- The permission bits are the same on the shared server
a-server
- The server treats
who-mount
asknown-user:known-group
(hereknown-group
is the default group ofknow-user
)
One suggestion is to use Fuse for macOS. It provides
custom uid/gid and permission bits options with -o
flag;
check out bindfs which mounts FUSE
drive and alters permission. With the bindfs, you can mount
permission-fetched smb drive after mounting the smb drive in the way
you mentioned.
But, I think, the best is each user has own shared drives.