NFS is a great service for sharing folders across your LAN. Although NFS isn’t quite as flexible as Samba (it doesn’t share printers or work with Active Directory), it’s considerably faster, which is great for working with larger files.
Besides being a bit easier to use than Samba, NFS is also a great option for networks that house various operating systems. The one caveat to NFS is that it’s not as secure as Samba. This is fine if you’re working on your home LAN, which no one else can access but you (and/or your family).
Also: 7 things I never do after I install Linux (and why you shouldn’t either)
Unlike connecting to NFS shares from a Linux client, connecting from MacOS requires an extra configuration, and the connection is best managed from Finder.
Let me show you how it’s done.
Configuring NFS for MacOS
What you’ll need: To connect to an NFS share from MacOS, you’ll need the following:
- A Linux machine with an NFS server up and running with a configured share
- A MacOS machine
- A user on the Linux machine with sudo privileges
That’s it! Here’ how to get set up.
Configure NFS on Linux
From within a terminal window, open the exports file for editing with the command:
<!–>
–> <!–>
sudo nano /etc/exports
If you’ve already configured NFS for a Linux machine, you’ll see a line that looks something like this:
–>
/share 192.168.1.253(rw)
The above line allows the machine at IP address 192.168.1.253 access to the /share folder with read and write permissions. That’s not enough for MacOS because it will produce an access error.
Also: How to share folders across your network from Fedora Linux
Let’s say your MacOS IP address (which can be discovered with the command ifconfig) is 192.168.1.70. The configuration line for that would be:
/share 192.168.1.70(rw,insecure)
The insecure option is necessary because NFS uses a port lower than 1024, and your MacOS user will not have permission to access that port. To turn that feature off, you must add the insecure option.
Also: 8 things you can do with Linux that you can’t do with MacOS
Save and close the file.
Restart NFS on the server
Next, we must restart the NFS server, so the changes take effect. To do this, issue the command:
<!–>
–> <!–>
sudo systemctl restart nfs-server
Make sure to verify NFS is running properly with the command:
–>
systemctl status nfs-server
You should see the service listed as active. If so, everything is ready for connection from the MacOS machine.
Mount your NFS share
Open Finder on your MacOS machine and hit the Cmd+K keyboard shortcut. This will open the Connect to Server dialog window, where you’ll need to enter the following:
nfs://ADDRESS/SHARE
Here, ADDRESS is the IP address of the NFS server, and SHARE is the name of the folder you shared. Upon successful connection, Finder will open the shared folder and display the files contained within.
The problem with this method is that once you close Finder, you’ll have a hard time locating the shared folder (as it doesn’t appear in the Finder sidebar).
There’s a better way: Open the terminal app and create a folder that will be used as a mount point for the share with the command:
mkdir nfs_share
With that folder ready, mount the share with the following command:
sudo mount -t nfs ADDRESS:/SHARE nfs_mount
Here, ADDRESS is the IP address of the NFS server and SHARE is the name of the shared folder. You’ll be prompted to enter your user password and, upon successful authentication, the share will be mounted and accessible. You might find one error that requires you to allow access to the folder – if so, click Allow when prompted.
Also: Arc’s ‘Air Traffic Control’ is a great way to keep your browser organized
Now, anytime you need to access the files in the share, you can open Finder and navigate to the nfs_mount folder in your home directory. The mount will remain persistent until you reboot the MacOS machine. If you do reboot, you’ll need to run the mount command to reclaim the connection.
–>