In this recipe, we will look at the various tools available for troubleshooting Samba shares.
Samba troubleshooting can be separated in to three parts: network connectivity, Samba process issues, and Samba configuration issues. We will go through each of them step by step. As a first step for troubleshooting, let's start with network testing.
Follow these steps to check network connectivity:
$ ping samba-server-ip
netbios
for name resolution:$ ping samba-server-name
tcpdump
to check Samba network communication. Start tcpdump
as follows and let it run for some time while accessing the Samba server from clients. All packets will be logged in a file named tcpdump
in the current directory:$ sudo tcpdump -p -s 0 -w tcpdumps port 445 or port 139
tcpdumps
with the following command:$ sudo tcpdump -s 0 -w tcpdumps host client_IP
telnet
:$ echo "hello" | telnet localhost 139
nmblookup
to test netbios name
resolution for Windows systems.Follow these steps to check Samba service:
$ sudo service samba status
netstat
to check the Samba daemon is listening on the network:$ sudo netstat -plutn
ps
to check the Samba processes. Look for the process name, smbd
, in the output of the following command:$ ps aux
strace
to view the Samba process logs. This will list all filesystem activities by smbd
process:$ strace smbd
Follow these steps to check Samba logs:
[global] log level = 3
smb.conf
to enable client-specific configuration:[global] log level = 0 log file = /var/log/samba/log.%m include = /etc/samba/smb.conf.%m
$ sudo vi /etc/samba/smb.conf.client1 [global] log level = 3
[global] log level = 0 log file = /var/log/samba/log.%u include = /etc/samba/smb.conf.%u
Follow these steps to check Samba configuration:
pdbedit
command:$ sudo pdbedit -L
smbtree
command:testparm
command to find any errors in the Samba configuration:$ testparm
@
symbol.[global] workgroup = WORKGROUP security = user browsable = yes [temp] path = /tmp public = yes
smbcclient
. It should list all Samba shares:$ smbclient -L localhost -U%