Samba notes
Some notes about debugging Samba, mainly because of a problem I encountered for which I found it very difficult to find solutions on the web.
Contents:
1. Some useful Samba commands
These commands run on a Linux system, and can be used to probe a running Samba server on the same system (or elsewhere as appropriate). They assume Samba client and server are installed.
testparm - check smb.conf file, and lists deviations from default configuration
smbclient -U <name> -L localhost - test connection to server on local machine (requests password for user <name>)
smbclient -d 3 -U <name> -L localhost - as above, but with debugging information
smbtree -U <name> - displayt tree of shares by server on local machine (requests password for user <name>)
smbstatus - displays information about Samba server status
2. Mysterious disappearing shares
(This is also reported at: https://www.scientificlinux.org/bug.feature/bugs/19/pcng_issue_view)
The other day (16 November) my Scientific Linux 4.0 server did a YUM auto-update of Samba from 3.0.10 to 3.0.25b. About the same time, my main share and printing stopped working, which have previously been working faultlessly for about a couple of years. I also lost my printing service.
I dug about on the web, and found some issues relating to Samba 3.0.25 and MSDFS; I've: (a) added
msdfs root = Yes msdfs proxy = no
to my smb.conf, and (b) rebooted by Windows XP client system (repeatedly!) with no change in symptoms.
If I try to mount using NET USE, I see this error:
C:\Documents and Settings\Graham>net use J: \\luggage\files System error 67 has occurred. The network name cannot be found.
(and see a similar problem, with even less useful diagnostic, if I try to connect drive via Windows explorer.)
But, interestingly, my server home directory (per smb.conf [homes]) connects OK:
C:\Documents and Settings\Graham>net use I: Local name I: Remote name \\luggage\graham Resource type Disk Status OK # Opens 1 # Connections 1 The command completed successfully.
I've also checked modified the services enabled in my XP system, per http://helpdesk.ugent.be/netdisk/en/bestand_mount.php?id=1. Similar problems have been noted on at least two other workstations (XP and Win2K), but those have not been investigated as fully.
Running testparm, I get:
[root@luggage mnt]# testparm Load smb config files from /etc/samba/smb.conf Processing section "[homes]" Processing section "[printers]" Processing section "[files]" Processing section "[dvd]" Loaded services file OK. Server role: ROLE_STANDALONE Press enter to see a dump of your service definitions [global] workgroup = NINEBYNINE server string = Luggage on SL-4.0 interfaces = eth1, lo guest account = guest log file = /var/log/samba/smbd.log max log size = 100 server signing = auto socket options = TCP_NODELAY SO_SNDBUF=8192 SO_RCVBUF=8192 printcap name = /etc/printcap os level = 64 preferred master = Yes local master = No domain master = Yes wins support = Yes ldap ssl = no remote announce = 193.123.216.127 remote browse sync = 193.123.216.127 idmap uid = 16777216-33554431 idmap gid = 16777216-33554431 hosts allow = 193.123.216.64/255.255.255.192 printing = cups cups options = raw print command = lpq command = %p lprm command = case sensitive = No msdfs root = Yes msdfs proxy = no [homes] comment = Home directories path = %H valid users = %S read only = No create mask = 0750 browseable = No [printers] comment = All Printers path = /var/spool/samba guest ok = Yes printable = Yes printer name = iconograph use client driver = Yes browseable = No [files] comment = Main served file area path = /raid/file read only = No create mask = 0774 [dvd] comment = DVD on Linux server path = /dvd guest ok = Yes [root@luggage mnt]#
There's no useful information in smbd.log
Smbstatus indicates no obvious problem:
[root@luggage ~]# smbstatus Samba version 3.0.25b-1.el4.2 PID Username Group Machine ------------------------------------------------------------------- 4425 graham graham conina (193.123.216.87) 4421 mandy mandy rincewind (193.123.216.80) Service pid machine Connected at ------------------------------------------------------- graham 4425 conina Sun Nov 18 16:04:03 2007 mandy 4421 rincewind Sun Nov 18 16:03:08 2007 Locked files: Pid Uid DenyMode Access R/W Oplock SharePath Name Time -------------------------------------------------------------------------------------------------- 4425 500 DENY_NONE 0x100001 RDONLY NONE /home/graham . Sun Nov 18 16:09:33 2007 4425 500 DENY_NONE 0x100001 RDONLY NONE /home/graham . Sun Nov 18 16:09:33 2007 4421 501 DENY_NONE 0x100001 RDONLY NONE /home/mandy . Sun Nov 18 16:04:09 2007 4421 501 DENY_NONE 0x100001 RDONLY NONE /home/mandy . Sun Nov 18 16:04:09 2007
The problem was also present when trying to connect from the same system, using smbclient:
[root@luggage ~]# smbclient -U graham -L localhost Password: Domain=[LUGGAGE] OS=[Unix] Server=[Samba 3.0.25b-1.el4.2] tree connect failed: NT_STATUS_BAD_NETWORK_NAME [root@luggage ~]#
I eventually got my system working again, though I'm not sure it's a fix to the problem as originally reported. The clue was here: https://bugs.launchpad.net/ubuntu/+source/samba/+bug/95460. The presence of msdfs proxy in smb.conf was the culprit, and when this was removed my shares started working again.
The testparm output now looks like this:
[root@luggage ~]# testparm Load smb config files from /etc/samba/smb.conf Processing section "[homes]" Processing section "[printers]" Processing section "[files]" Processing section "[dvd]" Loaded services file OK. Server role: ROLE_STANDALONE Press enter to see a dump of your service definitions [global] workgroup = NINEBYNINE server string = Luggage on SL-4.0 interfaces = eth1, lo password server = None guest account = guest username map = /etc/samba/smbusers log file = /var/log/samba/smbd.log max log size = 100 socket options = TCP_NODELAY SO_SNDBUF=8192 SO_RCVBUF=8192 printcap name = /etc/printcap os level = 64 preferred master = Yes domain master = Yes wins support = Yes ldap ssl = no remote announce = 193.123.216.127 remote browse sync = 193.123.216.127 idmap uid = 16777216-33554431 idmap gid = 16777216-33554431 guest ok = Yes hosts allow = 193.123.216.64/255.255.255.192 printing = cups cups options = raw print command = lpq command = %p lprm command = case sensitive = No msdfs root = Yes [homes] comment = Home directories path = %H valid users = %S read only = No create mask = 0750 browseable = No [printers] comment = All Printers path = /var/spool/samba printable = Yes printer name = iconograph use client driver = Yes browseable = No [files] comment = Main shared file area path = /raid/file read only = No create mask = 0774 [dvd] comment = DVD on Linux server path = /dvd
3. References
-- GrahamKlyne 2007-11-21 22:18:53

