I have an Ubuntu 20.04 server (a local VM in my case). How do I mount a directory on the Linux server from a macOS Catalina client, using NFS?
I have an Ubuntu 20.04 server (a local VM in my case). How do I mount a directory on the Linux server from a macOS Catalina client, using NFS?
Setting up the Linux server
Install the NFS server as per the Ubuntu NFS guide:
Edit
/etc/exports
:Now add a line similar to this:
/home/ubuntu
is the directory to export172.16.238.0/24
is the IP addresses to accept connections from. The Mac client's IP address should be in this range. Use*
to allow from any IP address. (But be careful not to make your NFS server available to the entire internet!)insecure
means to accept connections from unprivileged (higher) port numbersrw
means read-writeall_squash,anonuid=1000,anongid=1000
forces all reads and writes to be performed by the user/group with UID/GID 1000 (1000 is the defaultubuntu
user/group on my server). Runid
on the server to find out your UID/GID. You need these options unless your Ubuntu server and Mac client use the same UID/GID for the main user.no_subtree_check
is a performance thingSave the file and run
to reload the NFS exports. (I'm not sure if the
-a
option is necessary.)Setting up the Mac client
On the macOS client, edit the
/etc/auto_master
file (documented in theauto_master man page
):and change the line starting with
/net
to the following (or add it if necessary):locallocks
creates locks on the client rather than on the server. Without this, Finder becomes very slow and takes forever to show directories.nfc
makes UTF-8 file names workactimeo=1
sets the attribute cache timeout as short as possible. Note that setting it to0
(or addingnoac
) causes Finder not to notice when a file is deleted on the server, so we can't use it.nfsvers=4
here. I got kernel panics on the Mac with this, so I went back to the default (NFSv3).Note: It appears that some macOS software updates can overwrite this file and remove your changes. I've found myself having to go back to back to this answer once a year or so re-apply the changes.
Refresh the automounts by running
(If you previously tried to mount an NFS volume, unmount it first, like so:
sudo umount -f /net/fileserver.local/home/ubuntu
)In the Finder menu, select Go -> Go to Folder, and type
/net/SERVER_HOST_NAME
, e.g./net/fileserver.local
.You should find your exported directory in there, e.g. at
/net/fileserver.local/home/ubuntu
. Drag this directory to the Finder sidebar to make it easy to access in the future.