Tired of paying hundreds of dollars for commercial file serversoftware? Looking for an application that lets you share *NIX andWindows files seamlessly across a network? Say hello to Samba, softwarethat's so cool, it'll make you want to kick up your heels and dance,dance, dance!
We'll start with something very basic - setting up a temporary file area on your Linux server, to be shared by all connecting Windows clients.
Samba configuration is handled via a single file, named "smb.conf", which is stored by default in Samba's "lib" directory. This file is not installed during the installation process; you need to manually copy it from the source archive (usually from the "examples" directory) into your Samba directory tree and modify it as per your requirements. I'm not going to be doing that in this article, preferring instead to create it from scratch for illustrative purposes; however, you should peek into the default file when you have a minute and study the well-commented examples in it to better understand the kinds of configuration options possible.
Create a file named "smb.conf" in Samba's "lib" directory,
$ vi /usr/local/samba/lib/smb.conf
and add the following directives to it:
workgroup = medusa
server string = "Primary file server, 40GB"
comment = Temporary file area
path = /tmp
read only = no
guest ok = yes
As you can see, this configuration file is similar to a
standard Windows INI file, in that it is broken up into different sections, each containing variable-value pairs. Sections are identified by square braces around the section name, and lines beginning with semi-colons (;) or hashes (#) are treated as comments and ignored.
The first section of the file sets up global variables for Samba to use - in this case, it identifies the server as belonging to a workgroup named "medusa", and gives it a descriptive label. This information will be used by Windows clients when building the Windows Network Neighborhood.
The second section sets up a "share" on the server - this is simply a directory that is available to all connecting clients. In this case, I've selected the "/tmp" directory, give it the share name "temp" and set it to be writeable by all users.
Once you've saved your changes to the "smb.conf" file, it's a good idea to verify that it doesn't contain any errors by using Samba's very handy "testparm" tool.
Load smb config files from /usr/local/samba/lib/smb.conf Processing
section "[temp]" Loaded services file OK. Press enter to see a dump of
your service definitions
No errors? Time to start up Samba's "smbd" and "nmbd"
daemons, and make the "temp" share available to connecting clients.
If Samba starts up OK, you need to first verify that the
configured shares are active. You can do this by using the built-in SMB client that ships with Samba - it's called "smbclient", and it's a very handy tool for debugging problems.
If you can access SMB shares on the server itself, the next
step is to check if you can access them from other Windows clients. Fire up one of your Windows clients, log into it and see if you can find your server, either in the Network Neighborhood or via the Find Computer dialog box.
Once you find the server, you should be able to see and use the shared directory on the server.
You can also mount the share as a Windows-accessible drive via a unique drive letter, using the "net" command. Open up an MS-DOS window and try this:
c:\> net use t: \\olympus\temp
You should now see the "temp" share on the server as drive
letter T: in Windows Explorer.