HowTo: Samba Browsing Problems Checklist

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
altair4
Level 17
Level 17
Posts: 7897
Joined: Tue Feb 03, 2009 10:27 am

HowTo: Samba Browsing Problems Checklist

Postby altair4 » Wed Dec 07, 2011 8:09 am

HowTo: Samba Browsing Problems Checklist

NOTE: If you are in a Linux only or a Linux / macOS network there is a more modern method to resolve host names. Please see the "### SHARE DISCOVERY ###" section at the bottom


[1] Samba Browsing depends on all hosts being members of the same subnet.

If all your machines are connected to and get their IP address from the same router this happens automatically ( all of my machines are in the 192.168.0.xxx range with the same subnet mask of 255.255.255.0 ). But if you have set up static IP addresses yourself you need to make sure that they are in the same ip range and have the same subnet mask. Running the command: ifconfig on Linux and ipconfig on Windows should provide this information.

[2] Services not starting at boot.

Check to see that the following services are running:

Code: Select all

sudo service smbd status
sudo service nmbd status

If they are not running start them:

Code: Select all

sudo service smbd start
sudo service nmbd start

Debian users should use "samba" which contains smbd and nmbd in one service.

[3] Hostname

By default Samba will use the host name as the name it uses to identify itself to others on the network. But it can only be 15 characters or less in length. That's a requirement of Samba not Linux. So to see if you are in compliance run the following command and count the number of characters:

Code: Select all

hostname

If it's more that 15 characters long you could change the hostname but an easier way for samba purposes is to use a samba configuration file:

Code: Select all

gksu gedit /etc/samba/smb.conf

Add a line to the [global] section - right under the "workgroup" line is where I would put it:

Code: Select all

netbios name = some-name

Just make sure "some-name" is 15 characters or less in length.

Then restart samba:

Code: Select all

sudo service smbd restart

Code: Select all

sudo service nmbd restart

Debian users should use "sudo service samba restart" instead of the 2 commands above

[4] Name Resolution

Actual Samba communication is done by ip address not name. If you want to browse the LAN by name some mechanism must be provided to convert the name to an ip address. Windows machines use "node" specifications to determine the how and order of how this is done and Samba does as well with this line in the default settings:
name resolve order = lmhosts wins host bcast

* "lmhosts" and "host" are basically lookup tables that specify that this ip address belongs to this name - This is not set up by default.
* "wins" refers to a wins server that maintains a list - This too is not set up by default.
* The only default working system is bcast ( broadcast ) which Windows also uses but it appears last in order in Samba.

Rearrange the order to make bcast first by adding a line to the [global] section of /etc/samba/smb.conf - right under the "workgroup" line:

Code: Select all

name resolve order = bcast host lmhosts wins

And restart samba

[5] Firewalls

[5a] Disable the firewall on both of the machines that are trying to communicate and see if you can browse the LAN.

If you are using the built in firewall configurator then issue the following command to disable it:

Code: Select all

sudo ufw disable


[5b] To make sure that the required samba ports are open on both server and client install the following utility:

Code: Select all

sudo apt-get install nmap

And run the following command substituting 192.168.0.100 with the ip address of the machine you are on and again with the other machine on the lan:

Code: Select all

sudo nmap -sS -sU -T4 192.168.0.100

In a typical Linux setup the following ports should be open for Samba to work:
Interesting ports on 192.168.0.100:
Not shown: 1993 closed ports
PORT STATE SERVICE
139/tcp open netbios-ssn
445/tcp open microsoft-ds
137/udp open|filtered netbios-ns
138/udp open|filtered netbios-dgm


[5c] ( This is no longer an issue with the latest Mint ) If you do decide to use a firewall and think you have the right ports open you may find that browsing still doesn't work. That's because there may be an error ( omission ) in the base configuration of the firewall itself :

Edit the firewall configuration:

Code: Select all

gksu gedit /etc/default/ufw

Find this at the bottom:
# extra connection tracking modules to load
IPT_MODULES="nf_conntrack_ftp nf_nat_ftp nf_conntrack_irc nf_nat_irc"

And change the last line to this:

Code: Select all

IPT_MODULES="nf_conntrack_ftp nf_nat_ftp nf_conntrack_irc nf_nat_irc nf_conntrack_netbios_ns"

Then restart the firewall service:

Code: Select all

sudo service ufw restart


[6]
Workgroup

This isn't necessary if you have a normal home network where everyone is connected to the same router despite some samba howto's insisting that it "must" be done. I have multiple "workgroups" in my LAN and it is not an issue. I'm adding it here because invariably someone will post that it won't work unless you make all the workgroups the same:

Edit smb.conf as root:

Code: Select all

gksu gedit /etc/samba/smb.conf

Find the line:
workgroup = workgroup

And change it to whatever you want as long as it's not grater than 15 characters in length then restart samba.


The other problem the Samba user usually faces are permissions issues and that's unique to the user's situation and is not covered here.


Other HowTo's concerning setting up or accessing shares that you might find amusing:

### Installing Samba in Mint 18: viewtopic.php?f=42&t=224391

### SHARE CREATION ###
Simple File Sharing in Mint: http://forums.linuxmint.com/viewtopic.php?f=42&t=23169
Using the [homes] Share in Samba: http://forums.linuxmint.com/viewtopic.p ... 3&p=448039
Create Samba Shares Directly from Thunar: http://forums.linuxmint.com/viewtopic.php?f=197&t=88255

### SHARE DISCOVERY ###
Avahi Networking: http://forums.linuxmint.com/viewtopic.php?f=42&t=112833
Samba Browsing in an all Linux or Linux/OSX network: http://forums.linuxmint.com/viewtopic.p ... 10#p960482
Samba and Windows 10: http://forums.linuxmint.com/viewtopic.php?f=42&t=199907

### SHARE MOUNTING ###
On Demand CIFS Mounting of Shares: viewtopic.php?f=42&t=222087
Using Gigolo GUI to Mount Remote Samba Shares: http://forums.linuxmint.com/viewtopic.php?f=42&t=52144
Auto Mount Samba Shares on Boot ( GVFS Method ): http://forums.linuxmint.com/viewtopic.php?f=42&t=42713
Using AutoFS to Mount Remote Samba Shares: http://forums.linuxmint.com/viewtopic.php?f=42&t=144997

### NON-SAMBA NETWORK STUFF ###
HTTP for Fast Large File Transfers on Local Network : http://forums.linuxmint.com/viewtopic.php?f=42&t=139151
Another HTTP method using "woof": viewtopic.php?f=150&t=217786#p1140084
And another one using "droopy": viewtopic.php?f=150&t=223787&p=1178942#p1178942

### OTHER STUFF ###
Multi User Shared Local Directory: viewtopic.php?f=42&t=69834?f=42&t=69834
Using Bind to Remount Part of a Partition: viewtopic.php?f=42&t=74321
Fixing the Default umask in Mint: viewtopic.php?f=42&t=192794?f=42&t=192794
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 3 guests