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.

 

 

Observations:

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:

manveru@Monster:~$ cat /etc/hosts

127.0.0.1       localhost

127.0.1.1       Monster

 

# The following lines are desirable for IPv6 capable hosts

::1     ip6-localhost ip6-loopback

fe00::0 ip6-localnet

ff00::0 ip6-mcastprefix

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters

ff02::3 ip6-allhosts

 

 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.

127.0.1.1       Monster

 

 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

manveru@Monster:~$ cat /etc/hosts

127.0.0.1         localhost

127.0.0.1         Monster

192.168.1.100     Monster

 

 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.

#

#

# This is the main Samba configuration file. You should read the

# smb.conf(5) manual page in order to understand the options listed

# here. Samba has a huge number of configurable options most of which

# are not shown in this example

#

# Some options that are often worth tuning have been included as

# commented-out examples in this file.

#  - When such options are commented with ";", the proposed setting

#    differs from the default Samba behaviour

#  - When commented with "#", the proposed setting is the default

#    behaviour of Samba but the option is considered important

#    enough to be mentioned here

#

# NOTE: Whenever you modify this file you should run the command

# "testparm" to check that you have not made any basic syntactic

# errors.

# A well-established practice is to name the original file

# "smb.conf.master" and create the "real" config file with

# testparm -s smb.conf.master >smb.conf

# This minimizes the size of the really used smb.conf file

# which, according to the Samba Team, impacts performance

# However, use this with caution if your smb.conf file contains nested

# "include" statements. See Debian bug #483187 for a case

# where using a master file is not a good idea.

#

 

 

#======================= Global Settings =======================

 

 

[global]

 

 

## Browsing/Identification ###

 

 

# Change this to the workgroup/NT-domain name your Samba server will part of

   workgroup = WORKGROUP

   (Missing netbios name here)

 

# server string is the equivalent of the NT Description field

   server string = %h server (Samba, Ubuntu)

 

 

# Windows Internet Name Serving Support Section:

# WINS Support - Tells the NMBD component of Samba to enable its WINS Server

#   wins support = no

 

 

# WINS Server - Tells the NMBD components of Samba to be a WINS Client

# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both

;   wins server = w.x.y.z

 

 

# This will prevent nmbd to search for NetBIOS names through DNS.

   dns proxy = no

 

 

# What naming service and in what order should we use to resolve host names

# to IP addresses

;   name resolve order = lmhosts host wins bcast

Notice the above line is remarked out

 

#### Networking ####

 

 So to fix the above file, you need to make the 2 following changes.

 

sudo nano /etc/samba/smb.conf


# Change this to the workgroup/NT-domain name your Samba server will part of

   workgroup = WORKGROUP (Make sure the workgroup here Matches yours)

   netbios name = Monster (Add this line and make sure the Machine name is yours)

# What naming service and in what order should we use to resolve host names

# to IP addresses

   name resolve order = bcast lmhosts host wins

Remove the Semicolon from the line above and change the order putting bcast at the front.

 

 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

smbtree

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.

 

 

You have no rights to post comments