HowTo: Samba Browsing Problems Checklist

Write tutorials and howtos in here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Do not start a support topic here please. Before you post please read this

HowTo: Samba Browsing Problems Checklist

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

HowTo: Samba Browsing Problems Checklist

NOTE: This is not a how to on setting up and configuring a samba server or connecting to one. This is more a checklist so that you can avoid many of the more common Samba settings issues.

[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] 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 ( This may no longer be an issue with the latest Mint ):

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:

Simple File Sharing in Mint
: viewtopic.php?f=42&t=23169
Auto Mount Samba Shares on Boot ( GVFS Method ): viewtopic.php?f=42&t=42713
Using Gigolo GUI to Mount Remote Samba Shares: viewtopic.php?f=42&t=52144
Using AutoFS to Mount Remote Samba Shares: viewtopic.php?f=42&t=144997
Using the [homes] Share in Samba: viewtopic.php?f=42&t=77063&p=448039
Create Samba Shares Directly from Thunar: viewtopic.php?f=197&t=88255
Avahi Networking: viewtopic.php?f=42&t=112833
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 15
Level 15
 
Posts: 5516
Joined: Tue Feb 03, 2009 10:27 am

Linux Mint is funded by ads and donations.
 

Return to Tutorials / Howtos

Who is online

Users browsing this forum: No registered users and 14 guests