CloudLinux.ro
Storage & files

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 pricing

Related tutorials