Sub topic 6
Checking Your Samba Setup
This chapter assumes Samba is installed, smb.conf contains at least one share, and you can use sudo. You should also have a Samba user and a Linux client, or another machine from which to test the server.
Validate the configuration
Samba reads its main configuration from /etc/samba/smb.conf. A syntax error can prevent the service from starting or cause a share to be ignored. Run testparm after every configuration change:
sudo testparm -sThe -s option prints the effective configuration without asking interactive questions. A successful check ends with a message similar to:
Loaded services file OK.
Server role: ROLE_STANDALONEReview the printed share sections. Confirm that the path, read only, valid users, and other important settings have the values you expect.
Check the service and share listing
Confirm that the Samba service is running. The service name is commonly smbd on Red Hat-family systems. Some distributions use smb or package the service differently.
sudo systemctl is-active smbd
sudo systemctl status smbd --no-pagerFrom a client, list the server's published shares:
smbclient -L //fileserver -U aliceEnter Alice's Samba password when prompted. The response should list the expected share, such as projects. IPC$ and print$ may also appear. They are normal administrative or printer-related shares.
The verification path looks like this:
Test access and inspect sessions
Listing a share proves that the server advertises it. Test the actual share and its permissions:
smbclient //fileserver/projects -U aliceAt the smb: prompt, use:
ls
put test.txt
get test.txt downloaded-test.txt
exitIf this works, authentication, share selection, and basic file operations are working.
On the server, inspect active connections and open files:
sudo smbstatusUse logs for failures:
sudo journalctl -u smbd -b --no-pagerA permission-denied error can come from both Samba settings and Linux permissions. Check the complete path with namei -l, then verify the user's group membership with id alice.
| Symptom | First check |
|---|---|
| Share is missing | `testparm -s` and the share name |
| Authentication fails | `smbpasswd -a alice` and `valid users` |
| Access is denied | Directory ownership, mode bits, and SELinux |
| Connection times out | Hostname resolution and the firewall |
Exercise
Which command confirms that a configured share is actually reachable and usable by Alice?
Show answer
Run smbclient //fileserver/share -U alice, then use ls and a small put or get operation.