First Edit
I changed the hostname to a 7 characters word. The errors in log.nmbd concerning the can't-be-found server disappeared
Error – cannot find server MY-FILESERVER in workgroup WORKGROUP on
subnet 192.168.1.143
Now I see a new error showing up :
../source3/nmbd/nmbd_browsesync.c:251(domain_master_node_status_fail) domain_master_node_status_fail: Doing a node status request to the domain master browser for workgroup WORKGROUP at IP 192.168.1.143 failed. Cannot sync browser lists.
Now, when I run smbtree from the machine itself, I can see only one share folder. Also, in log.smbd I see this line :
Samba name server IDSHARE is now a local master browser for workgroup
WORKGROUP on subnet 192.168.1.143
I guess that the problem is that the subnet is a single IP address, instead of a group of addresses.
Initial Post
I'm configuring Samba but having a lot of trouble with it. The share machine and its shares do not appear when I run smbtree
. It's the first time I encounter this problem and wasn't able to figure out the origin. So I thought some of you could share some hints 😉
On a Ubuntu 16.04, I installed Samba 4.3.9. After restarting Samba, testparm
returns the following configuration :
# Global parameters
[global]
netbios name = MY-FILESERVER
server string = %h server (Samba, Ubuntu)
server role = standalone server
security = USER
map to guest = Bad User
obey pam restrictions = Yes
pam password change = Yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
unix password sync = Yes
syslog = 0
log file = /var/log/samba/log.%m
max log size = 1000
dns proxy = No
panic action = /usr/share/samba/panic-action %d
idmap config * : backend = tdb
[samba_test_folder]
comment = A test Samba share
path = /home/myname
read only = No
guest ok = Yes
Now, once I run smbtree
from another machine, I don't see the actual machine appearing. I see some Windows machines on the LAN and another Samba server, but not the one I care about.
Error log
I inspected the logs and saw in log.nmbd
the following line reappearing several times:
[2016/08/29 16:08:34.969537, 0] ../source3/nmbd/nmbd_become_lmb.c:533(become_local_master_browser)
become_local_master_browser: Error - cannot find server MY-FILESERVER in workgroup WORKGROUP on subnet 192.168.1.143
This is the main clue I found. Could it be possible that the result of hostname
must match the netbios server ? I read that netbios only uses names with 16 or less characters (source). hostname
returns a name with more than 16 characters on the machine I have problems with.
Checking running processes
I thought it could be a firewall issue but iptables -L
returned an empty rules table.
I checked if the processes were listening as they should. I scanned the ports with nmap -PN 192.168.1.143
(using local IP address), giving me :
PORT STATE SERVICE
22/tcp open ssh
139/tcp open netbios-ssn
445/tcp open microsoft-ds
MAC Address: 00:13:72:D6:5A:BA (Dell ESG Pcba Test)
I double checked on the machine itself with netstat -plunt
and seemed to confirm the fact that everything is running fine :
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 4837/smbd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2335/sshd
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 4837/smbd
udp 0 0 192.168.255.255:137 0.0.0.0:* 4789/nmbd
udp 0 0 192.168.1.143:137 0.0.0.0:* 4789/nmbd
udp 0 0 0.0.0.0:137 0.0.0.0:* 4789/nmbd
udp 0 0 192.168.255.255:138 0.0.0.0:* 4789/nmbd
udp 0 0 192.168.1.143:138 0.0.0.0:* 4789/nmbd
udp 0 0 0.0.0.0:138 0.0.0.0:* 4789/nmbd
The machine that causes trouble has a fixed IP address and matches the MAC address reported by nmap
and a single machine responds to this IP when running nmap -sP 192.168.1.0/24
.
I'm far from being an expert in Samba and Linux, so I may have missed something a bit obvious.
Best Answer
It seems that Samba has troubles when a static IP is defined through network interface. https://ubuntuforums.org/archive/index.php/t-844604.html
The interface was not well defined and after adding network 192.168.1.0 it worked as expected and the share was appearing in
smbtree
.