- Written by AC0VP AC0VP
This is just the beginning of this explanation on SAMBA setup in Linux, I have done a ton of research on getting SAMBA to work and have discovered that about 99% of the explanations give you a piece here or a piece there, but nobody seems to give the entire picture of how to set up SAMBA to work with Windows Shares on your local network after a fresh install. This article will also grow as I add in more pieces, I plan to add in CUPS printer sharing, additional security considerations etc..
Disclaimer: I am a 23 Year Windows Systems Administrator and have vast expertise in that world. but with that being said, I am only fair to middling with Linux and am still learning new things every day. So don't take this article as some high end Linux admins expertise instructions. It is what I discovered and it seemed to work extremely well after about 30 different attempts to get SAMBA Working correctly on my system to where I could access shares.
1.) After installing stock Ubuntu 13.10 and Linux Mint 16, the first thing I noticed about both of them was that I was unable to browse my local network's windows machines. Hell, I still can't see any of my other linux boxes in the Nautilus browser to this day unless I have SAMBA Installed on them , but I have not really worked on that piece either. That is all NFS Sharing and I have no interest at this point on getting that working. I can SSH to those boxes and that is all I need.
2.) Network Manager in Linux likes to try to handle it's own DNS with a Caching dnsMasque client built in, This can be left on or disabled, but it seemed to cause more problems than it helped with on my systems.
3.) SAMBA Does not set things up correctly upon installation to generally view and use Windows Shares.
How I Managed to Fix it.
I researched a lot of articles and was able to gather bits and pieces of information, but nothing really fixed my issues. After using the articles I found from various sources, I would issue a SMBTREE Command, and nothing would return, or I would try to browse the network from Nautilus and get varying errors about no response etc.. This was frustrating to say the least, so I am not going to link back to anyone's articles on this, none of them really did any good except to teach me what NOT to do.
1.) To Begin with, I am going to discuss the HOSTS File.
Example Stock File:
Note the 127.0.1.1 Entry. dnsMasque tries to cache dns locally with a 0 byte cache. Not experienced enough on dnsMasque, but this seems redundant and useless. I left it on and have no issues, but in some tests, I disabled dnsMasque through the /etc/NetworkManager/NetworkManager.conf file by remarking it out. Your results may vary with that.
I actually made the 2 following changes to the file: Changed the 127.0.1.1 to 127.0.0.1 and added the dhcp assigned address of my machine to Hosts. I would recommend against this part if your DHCP Server gives you a different IP Address every time, because you will have an invalid reference if you get assigned a different IP Address every time. But on my DHCP, I have a mac address reservation on the IP Address, so it never changes. So you should be able to ignore the 2nd entry change of 192.168.1.100 Monster if you run DHCP and it changes. I just noticed it helped speed things up a lot having it there. (Not really sure why), but I am sure some linux genious will comment about it eventually.
sudo nano /etc/hosts
This in and of itself did not resolve the issue, but it is the starting point. After later re-configuration attempts, I noticed the HOSTS File changes sped up my network browsing and through SMBTREE 400%, all responses were close to immediate instead of taking 30-45 seconds to get a response.
2.) Second step is to fix the smb.conf file located at /etc/samba. There is no netbios name defined and the network search order is remarked out by default. Below is an example of the first section of the file. Look for Bold text to explain what is missing.
So to fix the above file, you need to make the 2 following changes.
sudo nano /etc/samba/smb.conf
After saving these changed. Type the following 2 commands
sudo service smbd restart
sudo service nmbd restart
and then verify that you can see your network shares with
If you get a listing of network machines and shares. You should be good to go. You should then be able to go into Nautilus and click on Network and see your machines and Workgroups etc.
I will attach some screenshots and other options and file changes soon when I am back at my home machine to get them.
Feel free to post comments, but be warned, if you attempt to flame me for any of my descriptions, I will just delete the post. I love constructive criticism though. I have this information here to help people and flames are unwanted here. Re-Read the Disclaimer :) I have a low tollerance for flamers and assholes.