Sub topic 16
Troubleshooting Common File-Sharing Problems
Assume you can use the Linux command line, read service logs, edit configuration files, and interpret basic users, groups, permissions, IP addresses, and subnets. The examples use a Samba server named fileserver, an NFS server on 192.168.1.10, and a Linux client.
Use a layered troubleshooting method
Test the problem in this order:
- Name resolution and network reachability.
- Firewall and service status.
- Server configuration.
- Authentication and authorization.
- Local filesystem permissions and security labels.
- Client mount options and persistent-mount configuration.
This order prevents you from debugging permissions when the client cannot reach the server.
Check services, ports, and logs
On the server, check the relevant service and recent messages:
sudo systemctl status smb # Red Hat-family Samba unit
sudo systemctl status nfs-server
sudo journalctl -u smb -u nfs-server --since "15 minutes ago"Some distributions use smbd instead of smb. Confirm the unit name with systemctl list-units --type=service | grep -E 'smb|nfs'.
A timeout usually indicates routing or a firewall problem. An immediate “permission denied” response usually means authentication, export restrictions, ownership, or an SELinux denial. Check listening sockets and the server firewall:
sudo ss -ltnp | grep -E ':(139|445|2049)\b'
sudo firewall-cmd --list-allFor Samba, inspect active connections and authenticated users:
sudo smbstatusUse testparm -s after every smb.conf change. It detects syntax errors and displays the effective configuration. For NFS, compare the configured and active exports:
sudo exportfs -v
showmount -e fileservershowmount depends on the mount protocol service and may not provide useful information for every NFSv4-only setup. The active output from exportfs -v is then more reliable.
Diagnose permissions and SELinux
Samba checks both its share rules and the underlying Linux permissions. NFS normally checks the numeric user ID (UID) and group ID (GID), so the same name on two hosts does not guarantee the same identity. Check the path component by component:
namei -l /srv/samba/projects
ls -ldZ /srv/samba/projectsOn an SELinux-enabled server, inspect recent denials:
sudo ausearch -m AVC -ts recentDo not disable SELinux as a first fix. Apply the required file context or sharing boolean for the service and then retest.
Persistent mounts
For a boot-time failure, inspect the exact fstab entry and test it without rebooting:
sudo mount -av
findmnt /mnt/projects
journalctl -b | grep -E 'mount|cifs|nfs'Use _netdev for network filesystems. Keep Samba credentials in a root-readable file, not directly in /etc/fstab, and verify that the mount point exists.
| Symptom | Likely area | First check |
|---|---|---|
| Timeout | Network or firewall | `ping`, `ss`, and firewall rules |
| Access denied | Identity or permissions | `smbstatus`, ownership, UID/GID |
| Mount fails at boot | Ordering or credentials | `mount -av` and `journalctl -b` |
Exercise
Exercise
A client can ping the NFS server, but mounting fails with “access denied by server.” Which server-side command shows whether the client address is allowed by an active export?
Show answer
Run sudo exportfs -v and compare the client address or subnet with the export entry. Correct /etc/exports, then apply it with sudo exportfs -ra.