How To: Connect Clients to NFS Server

by

In a previous post I explained how to set up an NFS server on a Raspberry Pi. Here I provide info on how to set up an NFS client on common devices. I can’t cover all devices, but fortunately if it’s *nix the FreeBSD/Linux examples should work fine for most setups. Keep in mind this setup builds on my previous tutorial that gives anyone on the local network read/write permissions. If you’re keeping sensitive material on your server or the network is open to the public, I would recommend against this setup.

FreeBSD

To connect to a FreeBSD machine to your NFS server, first add the following line to /etc/rc.conf:

nfs_client_enable="YES"

Next, add the following line to /etc/fstab:

192.168.1.2:/nexus0 /home/beastie/nexus   rw,nolockd    0    0

192.167.1.2 = NFS server
/nexus = Folder on NFS server you want to mount
/usr/home/beastie/nexus = where you want to mount the NFS folder on your local machine—it can be anywhere, just make sure the folder exists
rw = read/write
nolockd = Disable file locking. I was unable to edit LibreOffice docs on the server before adding this option.

Reboot. Navigating to the appropriate folder should now show your NFS share.

Linux

There are a ton of different Linux distros so it’s impossible to cover them all. Some may have NFS preinstalled but I’m going to assume yours does not. Installing will depend on which family your distro belongs to:

Red Hat Family (Fedora, CentOS, AlmaLinux, Rocky)

sudo dnf install nfs-utils

Debian Family (Ubuntu, Pop!, elementary, Mint, 10 million others)

sudo apt install nfs-utils

Arch Family (endeavorOS, Manjaro, Garuda)

sudo pacman -S nfs-utils

SuSE (openSuSE and, uh, ?)

sudo zypper -n in nfs-client

SlackWare/Gentoo

If you use SlackWare or Gentoo you sure as hell aren’t looking for help on this site (if you are, sorry, I have no experience—maybe in the future I’ll fire them up in VM so I can make this guide more comprehensive).

Now you just have to add the following to /etc/fstab:

192.168.1.2:/nexus0 /home/beastie/nexus   rw,nolock    0    0

192.167.1.2 = NFS server
/nexus = Folder on NFS server you want to mount
/usr/home/beastie/nexus = where you want to mount the NFS folder on your local machine—it can be anywhere, just make sure the folder exists
rw = read/write
nolock = Disable file locking. I was unable to edit LibreOffice docs on the server before adding this option.

Now reboot.

macOS

First you need to mount the NFS share. In Finder, go to Go -> Connect to Server…. Type in nfs://192.168.1.2, replacing the IP address with the appropriate value for your server.

Connect to Server on macOS
NFS is nicely integrated in macOS

Tada! That’s it. You can add it to your “Favorite Servers” list with the + button for easy access in the future (like the Samba server I have in the screenshot above).

note: When I tried to actually use the server, I realized I didn’t have write permissions. I fixed this by logging into the server via ssh and giving read/write permissions to everyone using chmod -R 777 /nexus0 (replace “nexus0” with your NFS share). From a security standpoint, it’s probably not the best way to go, but as I mentioned earlier, nothing about this setup is designed with security in mind (basically, your router login/password unlocks everything in this setup, so make sure they’re secure and not the default values). After I changed the permissions I realized I probably could have instead added my macOS user to the “wheel” group. In macOS they have an “admin” group rather than “wheel.” I believe the problem was that “wheel” had read/write permissions on the server and macOS saw I wasn’t part of that group so it denied me permission to write.

If you want to automatically mount the drive on startup, go to System Preferences -> Users & Groups:

macOS Users & Groups
Auto-mounting the easy way

From here, just pres the + button, navigate to the appropriate folder, and select it.

iOS

I was surprised to find that Apple has pretty much completely ditched NFS in favor of Samba. I knew they had replaced AFS/AppleTalk with Samba on Macs, but I figured basic NFS support would still be there considering it was one of the first things Steve Jobs bragged about when he was showing off NeXT upon his return to Apple. iOS might be severely locked down, but you can still see that it hangs on to its original BSD roots if you look under the hood. Unfortunately, NFS didn’t make the transition.

Even more surprising, I couldn’t find a single app in the App Store that supported NFS. It seems Samba has really taken over, but I think the real reason NFS isn’t used much anymore is SSH. When you bolt SSH onto a file browser (SFTP), it basically does the same thing. In fact, if you want to forego NFS on the desktop, there are several *nix file browsers that will navigate your NAS using SFTP.

See my post on connecting to the server via SFTP.

F

Back to Top