Solve Samba/Windows conflicts with these tips

Samba can be an invaluable tool for organizations running a mixed Linux/Windows network, which is exactly why IT pros need to know how to keep Samba and Windows talking. Here's a one-two punch for fighting off a Samba networking conflict.

A number of problems can prevent Samba from properly creating bidirectional network connections between Windows and Linux systems. You can avoid protracted troubleshooting by learning solutions to two common problems: Windows password conflicts and the host gotcha.

This article assumes the following scenario: You've correctly installed Samba and configured Smb.conf, you can see the Linux system from the Windows Network Neighborhood dialog box, but you can only see your Linux box in the Linux version of Network Neighborhood (such as LinNeighborhood or smbclient). What's wrong? Here are two very likely possibilities.

Solving Samba problems with Windows passwords
Windows passwords should be first on your list when troubleshooting Samba networking conflicts with Windows shares. Check for these two potential Windows password problems:
  • Windows networking protocols require the same username on both systems. If you're logged in as "mike," you won't be able to connect to the Windows boxes unless they're also configured with an account called "mike," and this account must be logged in.
  • If the Windows PCs are running recent versions of Windows (Win 98 with Service Pack 2 installed or anything more recent, including Windows 2000), you'll need to disable encrypted passwords on the Windows boxes. Look in the Samba documentation directory (on Red Hat systems, this is located in the Samba directory in /usr/share/doc) for files containing the registration key (reg key) for the version of Windows you want to modify. In the Windows system, click Start, choose Run, type regedit, and click OK; when the Registration Editor opens, navigate to the appropriate location and change the default value as instructed in the Samba documentation.

Still having problems? Keep reading.

Solving the Samba/Windows host gotcha
If the above solutions do not resolve your Samba conflicts, odds are you've run into the famous host gotcha.

Perhaps you configured your /etc/hosts file to list all the computers on your network, figuring that this file would provide the needed IP addresses if all else fails. And, sure enough, Samba is configured to check this file—or so it seems. Actually, what Samba checks is the gethostbyname() function. But some distributions—notably, Red Hat—are configured so that this function returns only the name of the current host, not the contents of /etc/hosts.

To see the rest of the computers on your network, you'll need to edit the Samba configuration file and change the name resolve order from the default host lmhost broadcast win to lmhost broadcast win so that gethostbyname() doesn't come into the picture.

To make the needed changes to the Samba configuration file, do the following:
  1. In a terminal window, open a superuser session. Type su, press [Enter], and supply your root password.
  2. Launch a text editor and open /etc/smb.conf. Note: On some systems, this file is located in /etc/samba/smb.conf.
  3. Look for the section that begins with the following text: #All NetBIOS names must be resolved to IP addresses.
  4. Remove the semicolon at the beginning of the line ";name resolve order =..."
  5. On the same line, delete the word "host." Make sure the line contains "lmhosts."
  6. Save /etc/smb.conf (or, if the file was located in /etc/samba, save the file as /etc/samba/smb.conf).
  7. Open the file named lmhosts in the same directory. If no such file exists, create a new text file.
  8. In lmhosts, carefully type the IP address of each computer on your network, followed by its domain name and aliases, if any. Here's an example: localhost.localdomain localhost lothlorien bag-end moria mordor
  9. Save lmhosts to the same directory that contains Smb.conf.
  10. Exit the text editor.
  11. In the terminal window, stay in superuser mode. Type /etc/rc.d/init.d/smb restart and then press [Enter].
    Note: This script, called smb, may be located in a different directory on some systems.
  12. Now try accessing the network again.

Got a tip you’d like to share?
Let us know about the slick new Windows tip you’ve just learned by posting a comment below or by dropping us a note.


Editor's Picks

Free Newsletters, In your Inbox