HowTo: Samba Browsing Problems Checklist

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Post Reply
altair4
Level 20
Level 20
Posts: 11419
Joined: Tue Feb 03, 2009 10:27 am

HowTo: Samba Browsing Problems Checklist

Post by altair4 »

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: Samba Browsing in an all Linux or Linux/OSX network

NOTE: If you are using Mint 18 replace "gedit" references with "xed" below.
NOTE: If you are using Mint 19 replace "gksu gedit" references with "sudo -H xed" below.

[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
[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
[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 greater 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
### Mint 19 and Samba File Sharing Changes: viewtopic.php?f=42&t=270442
### Samba and Mint 20: viewtopic.php?f=42&t=322404

### 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: viewtopic.php?t=235248

### 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
Samba Without SMB1: viewtopic.php?f=42&t=249758

### 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
Last edited by altair4 on Mon Jun 22, 2020 8:13 am, edited 10 times in total.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
kb5050

Re: HowTo: Samba Browsing Problems Checklist

Post by kb5050 »

See that this topic is well aged, so I suspect a lot of the tweaks you suggest here, have been made.

My question, has anyone done a GUI application that works, and is maintained for Linux Mint? One that can guide you thru all of this rather than having to check out all the .conf files and so forth to bring your network in line.
YES I do want it to be as simple as Windows and Windows friendly at the same time because inevitably your Linux will likely be sharing its network with many devices but mostly Windows. And when I say this its to the end users benefit.
We like in a click happy world, so a terminal based world is far too dangerous and scary to any new computer user, not just Windows users.


Before I say much else, I happen to use Rosa 17.3 XFCE.

Now the persistent things I see in OOB fresh installs are thus.

By default it just cannot find network shares on a consistent basis. In other words in the File Manager you should be able to click on Network and instanly well somewhat, see all the Windows Computers, and Android, and Ios, and Mac, and NAS drives. But instead you typically get Timeout.
Now what is odd is that after 30 seconds sometimes, it will display Shares and Devices. I found that 1 change in smb.conf file seems to fix all of that.
Changing the search order. I just looked for that line and it does not appear in Rosa, so I assume they may have hard coded around it.
Suggestion, when you click on Network, an indicator should come up to say seeking network shares. This way you at least know something is going on or nothing is going on. The second issue that remains even in Sarah 18 is credentials are lost. While passwords are cool, they are not cool when it comes to Windows Public shares, NAS shares, and other shares. Despite ticking the remember forever it never remembers forever. This seems to only happen with WORKGROUP windows based shares. So that needs fixing. Also if the share your accessing, is to be a temporary share it probably should not have an option for forget password. Instead the radio button should say Delete Stored Password.
Then there is the age old issue of having to put a password on your password storage, which should be a Settings Manager thing to reset it, in a GUI that works like Windows Vault. Truthfully even Windows needs to make that easier to get to.

You can however get around this by using afp instead which does not exhibit the username/password and DOES remember forever.
I use that a lot, because Thunar allows Bookmarks, and once you create a bookmark, makes it easy to gain access. Just wish Thunar had the option to make a desktop and/or panel shortcut to a bookmark. Which brings me to the last suggestion, to fix Sarah to allow all or most applications to access Network and bookmarks from the application when you wish to open things. I feel you should also have an right click option on any listed folder to create a bookmark, create a panel shortcut etc.
A_J_Jackson

Re: HowTo: Samba Browsing Problems Checklist

Post by A_J_Jackson »

Yes, have followed that. Why does the full tree of samba shares display in the terminal with command smbtree but I can't access them in file manager or printer set up? It has only happened with Mint 19, prior versions have always been file. None of the network machines are running Win10, only XP to Win 7, plus 1 that is Mint 18. The shares on the (new) Mint 19 are accessible to the machine with Mint 18 - directly in Network connections without opening 'Windows Network'. The Mint 19 shares also show on the Mint 18 'Windows Network/XXGROUP folder. So my Mint 19 is sharing to the outside network but no applications on Mint 19 can see the outside network. Firewall on Mint 19 is disabled. Remember that smbtree does display, accurately, the network shares.

Thank you
rambo919
Level 5
Level 5
Posts: 675
Joined: Wed May 22, 2013 3:11 pm

Re: HowTo: Samba Browsing Problems Checklist

Post by rambo919 »

Just a bit of feedback

After a bit of leaving linux aside and going back to win7 to stop struggling with the OS itself and just get on with my life.... Linux started tempting me back. Running a LM19 in a VM in bridged mode I again attempted to get samba actually working, something that simply refused to happen in LM18. This time using this and the viewtopic.php?f=42&t=270442 guide together with a bit of googling I managed to get it working properly. In the end other than installing samba and adding a few test shares it took adding the quoted block to my smb.conf file and magically everything worked properly... note the last three lines that were needed for samba to access windows (win7, death to win10 {spits to the side}) shares as a guest. After that my only problem accessing samba shares from windows was due to me forgetting linux does not automatically remove trailing spaces the way I had gotten used to in windows and windows cannot access shares with a trailing space... after a headslap I fixed that.
#mirror in /etc/hostname, must be 15 characters or less with no spaces
netbios name = test-vm
# for win10 browsing remove this line
client max protocol = NT1
# next three lines seem needed
security = user
client use spnego = no
name resolve order = bcast host lmhosts wins
maxximux2000

Re: HowTo: Samba Browsing Problems Checklist

Post by maxximux2000 »

Hi Everyone,

I had issues connecting to my samba shares on my Linux Mint computer from my Windows 10 PC only to find out that the problem was the Win10 policies that were preventing to drive mapping to unauthenticated account. I'm adding the link here in case that can help someone

https://support.microsoft.com/en-ca/help/4046019

In my case that solved my issue.
ricobolo

Re: HowTo: Samba Browsing Problems Checklist

Post by ricobolo »

Thanks a Lot altair4, your explanations are clear, i am fighting for months about the share in dolphin, intense gogling about kde, dolphin, smb. and even sent a bug request to forums with no solutions. And now, thanks to you my share is working in dolphin ! I have tried with nemo, but I have a message that the "information about the list of share is broken(but by ip=ok)". I'am french, and i use openSuse/kde, but all the information you give save me from long hours to understand and find what happen on smb / win10, as everething was worked fine in windows xp before.
I have enabled SMB1 and SMB2/3 under windows and put the shared folder in bookmark after prompt in dolphin. Because for me, the browser can't access by name ( the dolphin browser see all machines by name but don't access), it can access by ip only. But for me for the moment is sufficient, with bookmark, as i try to share the pc since 6 months !
Sea Monkey
Level 1
Level 1
Posts: 21
Joined: Tue Mar 19, 2013 9:25 pm

Re: HowTo: Samba Browsing Problems Checklist

Post by Sea Monkey »

maxximux2000 wrote: Wed Aug 22, 2018 3:23 pm Hi Everyone,

I had issues connecting to my samba shares on my Linux Mint computer from my Windows 10 PC only to find out that the problem was the Win10 policies that were preventing to drive mapping to unauthenticated account. I'm adding the link here in case that can help someone

https://support.microsoft.com/en-ca/help/4046019

In my case that solved my issue.
Thanks for posting this. I did a substantial amount of troubleshooting server-side and this was actually the problem. It's worth noting that you shouldn't leave this setting enabled! I believe that what happened is that previous access to the share used guest access by default, which was remembered by Windows. When the Windows update disabled guest account access to a remote server, it failed to clear the remembered guest credentials, thereby preventing it both from accessing the share and prompting the user for credentials. In my case, I temporarily enabled guest access, opened the share, set it back to 'Not Configured' (disabled by default), and accessed the share again, at which point it prompted me for credentials.
User avatar
ibm450
Level 5
Level 5
Posts: 650
Joined: Sun Jan 11, 2009 6:56 am
Location: Hamilton Hill, Western Australia

Re: HowTo: Samba Browsing Problems Checklist

Post by ibm450 »

ive spent 3 days and night trolling the net for a work around on this half baked linux network stack and this was the only solution that has worked for me.

your a genius
HP EILITE FOLIO 9470M i7-3667u x 4
GitHub: tolgaerok
Image Image
Post Reply

Return to “Tutorials”