Dancing with Samba

Categories:

Over the past two weeks, I've been putting together a server so that people across the street from us at UMass Lowell (we're on-campus also) can mount their website files, hosted with us, as a network drive under Windows. This can be done with FTP, but it's still a bit messy. Fortunately, there's software out there, called Samba, that lets you make a Linux/Unix computer act as a Windows server. Here's how we've used it.

The first step is to set up a computer running Linux/Mac OSX/FreeBSD/NetBSD/Solaris... (any Unix flavor). This is a whole blog entry unto itself, but these days, it's not too hard, and it's getting easier and easier every day. Here at the CSL, we have a fairly well-established checklist for doing this, but there are always minor kinks in the process. Since our income is fairly small at this point (getting larger, thanks to some new grants and kind donors), our equipment is mostly hand-me-down. In this case, it meant learning about a new server we'd never spent much time on (memory on it must be installed in pairs!).

Once you have a computer running some form of Unix, you need to install the Samba software. For us, that means going to the command-line (GUI on a server? No Way!), typing:

apt-get install samba

and going through a few prompts. We use Debian GNU/Linux here at the lab, so your install procedure may be different.

I found helpful resources for the install part at:

 

 

So now Samba is installed, but it doesn't work right! Surprise, surprise. How could it possibly come pre-configured for everyone? To make things work properly, it means editing a file called smb.conf. In our case, this file is located in the /etc/samba directory, but again, your mileage may vary. You can either edit the smb.conf file directly, or you can edit it using a web-based tool called SWAT (Samba Web Administration Tool). I mostly edited the smb.conf file directly, but getting SWAT running was kind of fun, too.

So how to edit smb.conf directly? My preference is to use an editor called vi, but again, you have all kinds of choices. Some people may prefer to use emacs or Notepad (if they're the Windows sort) or TextEdit if they're on a Mac. Just has to be a text editor.

How to use SWAT? It has to be running, first of all. The easiest way to check is to open a browser and type in:

http://your.server.name:901

That's right: SWAT is a web server running on port 901.

If SWAT's not running, don't fear: it probably just means uncommenting a few lines or adding a few lines in your inetd.conf or xinetd.conf files. In my case, I just uncommented a few lines in /etc/inetd.conf and restarted the inetd process with:

/etc/init.d/inetd restart

But that's all I know right now about SWAT!

I won't go into much further detail about editing the smb.conf file, because I need to eat dinner, but there are some sections that govern the server's operation, and then you have one section for each file share (thing that becomes a network drive under Windows).

If this sort of thing interests you, and it should if you're wanting to avoid dishing out money for a Windows server license and want to learn more about Unix/Linux, here's a full list of resources, with descriptions, that I've used:

 

samba.org
The official site of the Samba project, samba.org has plenty of documentation on every Samba option under the sun. You can find the Samba manual as well as several e-books, including O'Reilly's Using Samba, which I found to be readable and easy to follow.
aboutdebian.com
This is a good website for people new to Debian GNU/Linux or for people who have never set up a particular type of server (like Samba!) using Debian.
linuxhomenetworking.com
This site is the much more complete version of aboutdebian.com. The author goes into extensive detail about how to install and configure web servers, file servers, logging servers, DNS servers, and many more, using Fedora Core (Red Hat) Linux. Very applicable.
Google
Everyone knows about it, everyone uses it, but I've yet to find a better place than Google to search for error messages.

--John