Linux and accessing the Windows shares

I had the problem of accessing the windows shares on my network, I’m using Ubuntu and getting inside the workgroup directory didn’t show any machines. So, I’ve found the solution which is pretty simple:

1. Samba config

# edit /etc/samba/smb.cnf
# set the name of your work group (although, I have 2 different work 
# groups in my network, and I can access them both after this configs)
workgroup = WORKGROUP
 
# setup the netbios name. Use whatever name your machine is called. 
# From samba.org: This sets the NetBIOS name by which a Samba server is known. 
# By default it is the same as the first component of the host's DNS name. 
# If a machine is a browse server or logon server this name (or the first 
# component of the hosts DNS name) will be the name that these services are 
# advertised under.
netbios name = ubuntu
 
# Reorder the naming services
name resolve order = lmhosts wins bcast host6

2. Add wins to Name Service Switch config

# edit /etc/nsswitch.conf or wherever NSS stores its config
 
# Add wins to hosts:
hosts:          files mdns4_minimal [NOTFOUND=return] wins dns mdns4

3. Restart Samba

# /etc/init.d/smbd restart

And that’s it, you should be able to access all of the shares across all of the workgroups.