By default, a Ubuntu desktop with Samba installed will be a member of the Windows workgroup named WORKGROUP. Because that machine is a member of WORKGROUP, you would think you could browse and connect to other machines on the same network by hostname. That is not the case. Instead you would still have to locate a machine's IP address in order to connect. This seems to defeat the purpose of Samba and the ability to join a workgroup. To make life easier you need to, after installing Samba, make a fairly straight-forward change that will then allow your machine to see and reach other machines by hostname. Let's see how this is done.
Naturally you need to have Samba installed on the machine you plan on using. There are a couple of ways to go about this. You can either open up the Ubuntu Software Center, search for Samba, and install Samba. Or you could open up Nautilus, right-click a folder, select Sharing Options, and the follow all of the prompts in order to get Samba correctly installed.
Once Samba is installed you can double check to make sure the Workgroup is correct by opening up the file /etc/samba/smb.conf and looking for the line:
workgroup = WORKGROUP
If you want (or need) to change the workgroup you belong to, change it there. After you make that change, save the file, and restart Samba with the command:
sudo service smbd restart
If you happen to use Firestarter, you are going to need to uninstall it and install a different firewalling tool (GUFW is one of my favorites). If you leave Firestarter installed and you reboot your machine (after making this change) your machine very well may not boot. I will say that I have found Firestarter to include a few bugs (such as getting through it with Port 631 - printing) to make removal a good move. GUFW is a GNOME front-end for ufw which is a much more reliable firewalling tool (and just as easy to use).
The last piece, before the configuration, is to install winbind. To do this issue the command
sudo apt-get install winbind. You will need to enter your sudo password for the installation to complete. Once that is installed, you are ready to configure.
The file you need to edit is /etc/nsswitch.conf. In this file you will see a line that looks like:
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
You need to edit this line so that it looks like:
hosts: files mdns4_minimal [NOTFOUND=return] wins dns mdns4
Once you have done this, save the file, and restart networking. To restart networking issue the command:
Hopefully you know the host names of some of the machines on your network. If so, try to ping one of those machines by name (not IP address). You should get a positive response back. If you do not know the hostname of any machine on your network you can always click Places > Network and then double click on the Windows Network icon. Once in this window you will see the WORKGROUP icon. Double click on that and it should show all of the machines on your network that belong to that same Workgroup. Take one of those names and try to ping it. You should get positive results back.
Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.
We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats or subscription fees.
If you like our content, and would like to help, please consider making a contribution:
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.