Basic NFS Server and Client on RHEL/CentOS, Debian/Ubuntu and Derivatives


Install the NFS utilities, start and configure the service to run automatically on boot:

dnf install nfs-utils nfs4-acl-tools systemctl enable nfs-server.service systemctl start nfs-server.service

To configure firewalld to permit network access to the NFS services run:
firewall-cmd --permanent --add-service=nfs firewall-cmd --permanent --add-service=rpc-bind firewall-cmd --permanent --add-service=mountd firewall-cmd --reload

apt install nfs-kernel-server rpcbind systemctl enable nfs-kernel-server systemctl start nfs-kernel-server

To configure ufw to permit network access to the NFS services run:
ufw allow from to any port nfs ufw enable

Configuration files are located at /etc/nfs.conf and /etc/nfsmount.conf.

Create or edit /etc/exports:
/mnt/share1 /mnt/share2,async) /mnt/share3,sync) /mnt/share4,sync,no_all_squash,root_squash)

Specify the single IP address or range in CIDR notation that a share should be accessible to followed by its options in (brackets).

See man exports for detailed information about per-share configuration options.

To reload the exports configuration live, run:
exportfs -ar

To configure disk quotas please see Mass Virtual Hosting Part Three: Disk Quotas (including NFS).


dnf install nfs-utils nfs4-acl-tools

apt install nfs-common

To view the exported shares on the remote server:
showmount -e

To mount a remote share:
mount -t nfs /mnt/shared

To add a remote share to fstab (automatically mount at boot, simplified mount /mountpoint): /mnt/shared nfs defaults 0 0


There are no comments for this item.