How to set up an NFS share between Linux servers
Updated 7/20/2026
NFS lets you share a directory from one server (the NFS server) to other servers (clients), which use it as if it were local. Useful for common files across several app servers.
On the NFS server
apt-get install -y nfs-kernel-server
mkdir -p /export/data
In /etc/exports, allow the clients (ideally only from the private network):
/export/data 10.10.0.0/24(rw,sync,no_subtree_check)
exportfs -a
systemctl restart nfs-kernel-server
On the client servers
apt-get install -y nfs-common
mkdir -p /mnt/data
mount 10.10.0.1:/export/data /mnt/data
Automatic mount
In /etc/fstab on the client:
10.10.0.1:/export/data /mnt/data nfs _netdev 0 0
Security
Run NFS only over a private network, never directly on the internet, and restrict access with the firewall.
Put this guide into practice on your own VPS
EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.
See pricingRelated tutorials
How to encrypt files and backups
Protect sensitive data by encrypting files and backups before storing or transferring them.
Updated 7/20/2026Storage & filesHow to sync files automatically with Syncthing
Syncthing syncs files in real time between servers and devices, encrypted and without an external cloud.
Updated 7/20/2026Storage & filesHow to manage disk space and partitions
See how your disks are organized, mount a new disk and expand space when you need it.
Updated 7/20/2026