Based on the Linux Master 1 exam syllabusReport an error
rpcbind (port 111) is not alive, NFS itself does not work./etc/exports. The format is directory client(options), and there must be no space between the client and the parenthesis.exportfs -ra, and verify with exportfs -v. The client queries with showmount -e and attaches with mount -t nfs.rpcbind (formerly named portmap).rpcbind (fixed port 111) "which port is the NFS service on?" → it then does the actual NFS communication on the port it is told.rpcbind is dead.| Component | Role |
|---|---|
rpcbind (port 111) | Port mapper that brokers the port information of RPC services |
nfs-server (nfsd) | The NFS daemon that handles the actual file I/O requests |
mountd (rpc.mountd) | Receives the client's mount requests and checks permissions |
rpc.statd / lockd | Manage file locking and state recovery |
The precondition for NFS to work is that rpcbind (port 111) must be alive. The number one cause of "NFS mount doesn't work" is rpcbind not running on the server or client, or port 111 being blocked by the firewall. You can check the registered RPC services with rpcinfo -p server_IP.
# Check the list of RPC services registered on the server
rpcinfo -p localhost
# Start NFS-related services (RHEL family)
systemctl start rpcbind nfs-server
systemctl enable rpcbind nfs-server/etc/exports.directory_to_share client(option,option,...) client2(option,...)
# /etc/exports example
/srv/share 192.168.1.0/24(rw,sync,no_subtree_check)
/data/public *(ro,sync)
/home/team 192.168.1.10(rw,sync) 192.168.1.20(ro)
/secret server.example.com(rw,sync,root_squash)⚠️ Critical trap:
192.168.1.10(rw)and192.168.1.10 (rw)are completely different. Without the space it means "rw permission for host 10"; with the space it is interpreted as "default permission (ro) for host 10, and rw permission for all hosts (*)". This difference leads directly to security incidents.
| Notation | Meaning |
|---|---|
192.168.1.10 | A single specific IP host |
192.168.1.0/24 | An entire subnet |
*.example.com | All hosts in the domain (wildcard) |
* | All hosts |
server1 | A host name |
| Option | Meaning |
|---|---|
ro | Read only |
rw | Read and write |
sync | Reply after writing data to disk (safe, default and recommended) |
async | Reply before writing to disk (fast but risky) |
root_squash | Demotes the client's root to an anonymous user (nfsnobody) (default, security) |
no_root_squash | Treats the client's root as root on the server too (dangerous) |
all_squash | Demotes all users to anonymous |
no_subtree_check | Skips the subtree check (performance, recommended) |
secure | Only allows requests coming from privileged ports below 1024 (default) |
What root_squash means: by default, NFS does not trust the client's root. Even if you touch a shared file as root on the client, the server treats you as nfsnobody (an anonymous user). This is root_squash, and it is the default. no_root_squash is a dangerous option to use only in trusted environments — it lets the client's root handle the server's files freely with root privileges.
/etc/exports, you must apply its contents to the NFS server.exportfs is the tool that refreshes just the export table without restarting the whole service.| Command | Meaning |
|---|---|
exportfs -a | Export all entries in /etc/exports (all) |
exportfs -r | Re-read and refresh the export table (re-export, the most used after editing) |
exportfs -u | Unexport a specific export (unexport) |
exportfs -v | Print the current export list in detail (verbose) |
exportfs -ra | Re-apply everything (a commonly used combination) |
# Apply the changes after editing /etc/exports
exportfs -ra
# Check the list currently being exported
exportfs -v
# Unexport a specific share
exportfs -u 192.168.1.0/24:/srv/sharevi /etc/exports → exportfs -ra → verify with exportfs -v. Restarting the NFS server (systemctl restart nfs-server) also applies the change, but during operation the standard practice is to refresh without downtime using exportfs -ra.
showmount.# Show the list of shares the server exports (-e = exports)
showmount -e 192.168.1.100
# Show the clients currently mounted on the server
showmount -a 192.168.1.100mount -t nfs.# Mount a remote NFS share on a local directory
mount -t nfs 192.168.1.100:/srv/share /mnt/share
# Specify mount options
mount -t nfs -o rw,soft,timeo=30 192.168.1.100:/srv/share /mnt/share/etc/fstab.# /etc/fstab entry example
# server:remote_path mount_point type options dump check
192.168.1.100:/srv/share /mnt/share nfs defaults,_netdev 0 0⚠️ The
_netdevoption: when you register NFS in/etc/fstab, adding_netdevmeans "mount after the network is up". If you leave it out, the system may try to mount before the network is ready during boot, and the boot can hang.
| Option | Behavior |
|---|---|
hard | Retries indefinitely if the server does not respond (default, data-safe) |
soft | Returns an error and gives up after a set time (timeo) (favors responsiveness) |
Why hard is the default: for data integrity, NFS uses a hard mount by default. Even if the server stops briefly, work continues once it recovers. However, if the server dies for good, processes can fall into an infinite wait, so this is sometimes supplemented with intr (allow interrupts) or soft.
| Item | NFS | Samba (SMB/CIFS) |
|---|---|---|
| Main use | Sharing between Unix/Linux | Windows ↔ Linux sharing |
| Protocol | NFS (RPC-based) | SMB/CIFS |
| Key config file | /etc/exports | /etc/samba/smb.conf |
| Apply/manage commands | exportfs | testparm, smbpasswd |
| Dependent services | rpcbind (port 111) | smbd, nmbd |
| Mount type | mount -t nfs | mount -t cifs |
| Main ports | 111 (rpcbind), 2049 (nfs) | 139/445 (smbd), 137/138 (nmbd) |
| Authentication | Host (IP) based + user UID mapping | User account/password based |
| Permission model | Linux UID/GID as-is | Samba account + Linux permissions |
Selection rule in one line: if the sharing parties are all Linux/Unix, use NFS; if Windows is mixed in, use Samba. The key is the difference in philosophy: NFS trusts per IP (host), while Samba authenticates per user account.
Difference in authentication models: NFS trusts the client's UID/GID as-is. A user with UID 1000 on the client is treated as UID 1000 on the server too. So in an NFS environment, you must match user UIDs between server and client (or unify them with NIS/LDAP) to avoid permission confusion. Samba authenticates with Samba's own accounts regardless of that.
# === Server side ===
# ① Install packages
yum install nfs-utils
# ② Prepare the shared directory
mkdir -p /srv/share
chmod 755 /srv/share
# ③ Edit /etc/exports (watch the spaces!)
echo "/srv/share 192.168.1.0/24(rw,sync,no_subtree_check)" >> /etc/exports
# ④ Start the services
systemctl start rpcbind nfs-server
systemctl enable rpcbind nfs-server
# ⑤ Apply the exports
exportfs -ra
exportfs -v
# ⑥ Open the firewall
firewall-cmd --add-service=nfs --add-service=rpc-bind --add-service=mountd --permanent
firewall-cmd --reload
# === Client side ===
# ⑦ Check the server's shares
showmount -e 192.168.1.100
# ⑧ Mount
mount -t nfs 192.168.1.100:/srv/share /mnt/shareTry it yourself: deliberately put a space in /etc/exports, like 192.168.1.10 (rw), and check the result with exportfs -v. Seeing with your own eyes that rw gets granted to * against your intent makes the space trap unmistakable. Also stop rpcbind on purpose (systemctl stop rpcbind) and observe how the mount fails.
Tomorrow we cover firewalls that protect the system from the outside — iptables and firewalld.
portmap./etc/exports on the server. -ra re-applies everything, -v shows the list.-e) or the clients currently mounted (-a)./etc/fstab option meaning "mount after the network is up". Leaving it out can make the boot hang.Click a choice to reveal the answer and explanation.
Question 1
Which daemon is essential for the NFS service to work, and brokers the port information of RPC services?
Question 2
Which of the following correctly describes the /etc/exports entry below?
```
/data 192.168.1.0/24(rw,sync)
```
Question 3
Which is the correct result of putting a space between the client specification and the option parentheses in /etc/exports?
Question 4
Which command refreshes the export table without restarting the NFS server after editing /etc/exports?
Question 5
Among the NFS export options, which default option strengthens security by demoting the client's root user to an anonymous user on the server?
Question 6
Which command checks, from the client, the list of shared directories the NFS server exports?
Question 7
Which of the following statements comparing NFS and Samba is incorrect?