Setting Up Samba
25 April 2006As I mentioned in an earlier post, one of the reaons I'm setting up this Linux box is to see if I can make do the normal things that I do with Windows XP. Of course, that means I need to be able to network my Linux box with other Win XP boxes. The easiest way to do that is with Samba.
Samba is generally installed with most Linux distros and mine was no exception. i searched in Kpackage for Samba under installed packages and was able to determine that it was installed. Next step was to configure Samba.
There is plenty of online documentation for Samba. I recommend picking one or two of the more extensive documents and staying with them. They offer step-by-step approaches to installing Samba, starting with basic networking capability and building up as each cabability is checked and confirmed working. Two sites that I used are Using Samba, an online O'Reillly book, and The Official Samba-3 HOWTO and Reference Guide. Either one provides more than enough info to get started.
Both texts have you working from a command line, which I find is common for most Linux documentation. I don't mind doing that, but I do have to admit, that I think it continues to be a disadvantage for Linux since many new users will be looking for graphic interfaces like they are accustomed to in Windows. The interesting fact is that for many Linux functions, there now are graphical interfaces, but it seems more difficult to find solid documentation on them.
I primarily used the O'Reilly book, Using Samba, and followed its approach to get Samba configured. It does a good job of leading you through the various config files that need to be checked to insure Samba will function correctly. My biggest challenge was find the Samba config file. it wasn't in the directory that the book suggested and my efforts at using the Find command from the command line didn't work either. I finally remembered that I had taken some notes from a previous Samba installation and discovered the smb.conf file in /etc/samba/, where most config files are stored. I should have looked there earlier, but the book had me pointed in another completely direction.
One nice feature of Samba is that there is a browser-based graphical configuration program called Swat. You can access it by typing http://localhost:901 in a browser. The first time I tried to access it didn't work, even though I had followed the steps to ensure the config files were properly set. Then i discovered that Swat is not automatically installed with the Samba package and that I needed to install it. Back to Kpackage to install Swat and everything started to work.
I used Swat to set up the basic network configuration suggested in the documentation, which sets up a shared directory on the Linux box and nothing else. I followed the book's recommended steps to check that the network was working. Most of this included command line work that was reasonably straight-forward. I ran across a couple of commands, most notably nmblookup, that never seemed to work the way that the book indicated they should. The problem wasn't the network, but the syntax of the command. In any event, I was able to verify that a basic netwrok connection between my Linux box and Win XP box existed and that both machines saw each other. (You can probably tell that I'm not a real network expert. I know just enough to be dangerous. I should also add that i've had a problem with my Win XP network not being able to see machine names so that coul be contributing to the nmblookup problems. If you have similar problems, just try accessing the various machines using IP addresses. It's worked fine for me and takes one more variable out of the equation.)
I should add here that the documentation also includes a section on setting up the Win XP client so everything you need can be found in a single source.
The key command, in my estimation, is smbclient, which displays shared resources and lets you know if the network is set up properly. My Linux box is named Debian so I tried smbclient -L debian, which should show me all the shared resouces on my Linux box. It did. Then I tried the same thing for my Win XP box, named WinXP. That also worked and it displayed all of the shared directories on the Win XP box. One note here is using passwords. Win XP wants encrypted passwords so be sure to set that option in Swat. Also, you need to configure a password file in Linux, which the documentation explains. If you don't do that, the network will probably not work. The documentation recommends using the same password for both machines, Linux and XP. For a while, I couldn't get smbclient -L debian to work. I found an online reference that suggested trying smbclient -L debian -N, which allows an anonymous access to the selected machine. If you've having access/password problems, I recommend trying smbclient with the -N (no password) option. I discovered later, that the basic Samba configuration file has line in its [global] section the says "invalid users = root." After I commented that line out (by putting a ; in front of it), the smbclient -L debian command worked fine.
Another very useful place to check out your Samba setup is from the official Samba How-To called The Samba Checklist. You can view it online here or you can also find it in your Linux documentation. In my distro it is located at /usr/share/doc/samba/diagnosis.html. This is a very nicely written diagnostic checklist that takes you step-by-step through a typical Samba setup and tells you how to check to make sure everything is working. If a check fails, the documentation offers detailed advice on what may possibly be wrong and how to correct. I highly recommend it.
So, from the command line, it looks like my network is working fine and both machines can see each other. Now how do I translate that into being able to access the files on the shared resources through 'normal' file managers, both in Linux and Windows? That will be the subject of my next post.
No comments yet