Mastering NFS on Linux: Installation, Configuration, and Troubleshooting Guide
This comprehensive guide walks you through installing NFS utilities on Linux, configuring /etc/exports, setting appropriate permissions, specifying ports, enabling services at boot, mounting NFS shares on clients, and resolving common errors such as permission issues and network error 53 across Windows and Linux environments.
Comprehensive NFS Guide
1. Installation
yum install nfs-utils -y2. Configuration
Main configuration file: /etc/exports Example entry:
/nfsfile 192.168.10.*(rw,sync,root_squash) /nfsfile– shared directory; ensure proper permissions (e.g., 777). 192.168.10.* – allowed client IPs; use * for any. (rw,sync,root_squash) – options; see meanings below.
Option meanings:
ro : read‑only.
rw : read‑write.
root_squash : map root client requests to anonymous UID/GID.
no_root_squash : preserve root identity.
all_squash : map all client users to anonymous.
sync : write synchronously to disk.
async : write asynchronously for performance.
anonuid : anonymous user ID.
anongid : anonymous group ID.
NFS Specified Port
# View RPC services
rpcinfo -p localhost
# Set mountd port
grep "PORT" /etc/sysconfig/nfs
# Example ports
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
MOUNTD_PORT=892
STATD_PORT=662
STATD_OUTGOING_PORT=2020
# Open firewall ports
firewall-cmd --add-port={111/tcp,111/udp,2049/tcp,2049/udp,32769/udp,2020/tcp,662/tcp,892/tcp,32803/tcp} --permanent
firewall-cmd --reload
systemctl restart nfs-server
rpcinfo -pSome guides suggest adding RQUOTAD_PORT in /etc/sysconfig/nfs , but it worked without it on CentOS 7.4 with nfs-utils‑1.3.0‑0.61.el7.x86_64.
3. Start and Enable at Boot
Before using NFS, start and enable rpcbind and nfs-server:
systemctl restart rpcbind
systemctl enable rpcbind
systemctl restart nfs-server
systemctl enable nfs-server4. NFS Client Mount
Use showmount to list exports:
showmount -e 192.168.10.10
Export list for 192.168.10.10:
/nfsfile 192.168.10.*Create a local mount point and mount the share:
mkdir /nfsfile
mount -t nfs 192.168.10.10:/nfsfile /nfsfilePersist the mount by adding to /etc/fstab:
192.168.10.10:/nfsfile /nfsfile nfs defaults 0 05. Errors and Solutions
5.1 NFS root mount but regular users lack write permission
Set anonuid=0, anongid=0 and all_squash in /etc/exports so all client accesses map to root, granting write rights.
If client and server share the same UID, you can set anonuid to that UID to preserve ownership.
5.2 Network error 53 – add insecure option
For Windows 2008 Server clients, include insecure in the export options.
5.3 Network error 53 – use no_root_squash
Ensure no_root_squash is set in /etc/exports and restart the NFS server.
systemctl start nfs-server5.4 Network error 53 – set shared directory permissions to 777
5.5 Network error 53 – correct mount path syntax
For multi‑level directories, use forward slashes ( /) instead of backslashes.
mount \\192.168.1.23\home X:
mount \\192.168.1.23\home/test X:5.6 Network error 53 – choose an unused drive letter (e.g., X, Y, W) when mapping to a local disk
6. Installing NFS Client on Windows
Windows Server 2008
Via Server Manager, add the “File Services” role, then install the “Services for Network File System” feature. After installation, start the “Client for NFS” service.
Windows 10
Enable the “Client for NFS” feature in “Turn Windows features on or off”.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
