Server side
1. Install nfs server
sudo apt-get install nfs-kernel-server -y
2. Update share configuration
Append to file /etc/exports
/nfsshare *(rw,all_squash,insecure,async,no_subtree_check,anonuid=33,anongid=33)
Following configuration applied:
/nfsshare
: the folder we share in network*
: limit the ip range, eg: to allow all IP’s from192.168.0.0
to192.168.0.256
, we can replace the asterisk with192.168.0.0/24
.rw
: allows both read and write requests on the NFS volumeall_squash
: map all uids and gids to the anonymous userinsecure
: allows clients with an NFS implementation that doesn’t use a reserved NFS portasync
: allows the NFS server to break the NFS protocol to improve performance at the cost of data potentially becoming corrupted if the server crashesno_subtree_check
: disables subtree checking, while it comes at a cost to security it can improve the reliability of the NFS serveranonuid=33,anongid=33
userId and groupId for a user that is connecting anonymously
3. Apply new exportfs config:
sudo exportfs -ra
That’s all for server-side!
Client side
Ubuntu
1. Install client:
sudo apt install nfs-common
2. Test mount point
# create folder for mount point
sudo mkdir /pi-server-02
sudo mount 192.168.1.196:/nfsshare /pi-server-02
3. Permanent mount
If it’s works in the previous step, you can create an /etc/fstab
entry:
192.168.1.196:/nfsshare /pi-server-02 nfs defaults 0 0