I'm trying to connect to an NFS folder on my dev server. The owner of the folder on the dev server is darren and group darren.
When I export and mount it to my Mac using the Disk Utility it mounts, but then when I try to open the folder is says I do not have permissions. I have set rw, sync, and no_subtree_check. The user on the Mac is darren with a bunch of groups.
Do I need to have the same group and user set to access the folder?
NFS is built on top of RPC authentication. With NFS version 3, the most common authentication mechanism is AUTH_UNIX. The user id and group id of the client system are sent in each RPC call, and the permissions these IDs have on the file being accessed are checked on the server. For this to work, the UID and GIDs must be the same on the server and the clients. However, you can force all access to occur as a single user and group by combining the all_squash, anonuid, and anongid export options. all_squash will map all UIDs and GIDs to the anonymous user, and anonuid and anongid set the UID and GID of the anonymous user. For example, if your UID and GID on your dev server are both 1001, you could export your home directory with a line like
/home/darren 192.168.1.1/24(rw,all_squash,anonuid=1001,anongid=1001)
I'm less familiar with NFS version 4, but I think you can set up rpc.idmapd on the clients to alter the uid and gid they send to the server.
When you mount NFS, your permissions you're mounting it with must match up with what you have on the server. For example, if your user has only read-only access, mounting it with read-write will cause you to see the same errors you mentioned in your post when you try to actually load the mount. Unfortunately, this will ONLY show up when accessing the folder, not when you actually mount it.
You also want to make sure that the user NFS is running as on the server and the user on the client are using the same UID and GID. You can check these values by running
id darren
on both the server and the client. If the UID and GID values do not match up, you can edit/etc/passwd
to make it so — but make sure you understand what you're doing before arbitrarily changing values!Some good sources:
I hope this helps!
Do your UIDs and GIDs match on both servers? That's what it's using to control access and not the login and group name.
Example on how to mount a NFS share on Ubuntu Eoan as a server and MacOS Catalina as a client.
Example assumptions (you need to adapt this):
Client PC name: Bills-MBP
Username in Ubuntu: tux
PC name of Ubuntu: dustycray
Folder on Ubuntu to be shared: /home/tux/mp3
On the NFS-Server (Ubuntu EOAN in my case) enter in the terminal (which we opened as shown above):
Now on the mac, open a terminal as shown above and enter (leave /private/nfs as it is):
Then the NFS can be accessed in the path /private/nfs. In finder you will see a new entry called (e.g.) "dustycray" on the left in the section "locations", also in file-open dialogs.
Above's mount procedure is not permanent, I use a script to mount it whenever I need it. However, you can also make the mount permanent if you like (e.g. System preferences / Users&Groups / Login Items / + / Select any root folder within (!) the NFS share / Add).
For me the issue was fixed by providing
_netdev
mounting option on client.I.e. add this to
/etc/fstab
: