Swat Configuration
Swat Configuration
Samba is a file and print server for Linux (and many flavors of UNIX) that can e
mulate a Windows NT/2000 machine. The most recent version of Samba can even act
as a stand-alone Primary Domain Controller. A Linux Samba server can also be an
effective and inexpensive alternative to standard Windows file and print servers
.
Installing and setting up Samba and SWAT
On many newer Linux distributions, SWAT installation is quite easy. Often, if yo
u install Samba, SWAT is automatically installed as well. When you install some
distributions, you need to opt to select packages and then make sure you choose
to install the SWAT package.
If you do not have Samba and/or SWAT installed on your Linux machine, you can in
stall both packages manually. If you install the latest version of Samba, SWAT i
s installed automatically as part of the package, as mentioned above. To get the
latest Samba installation packages, go to Samba's Web site, download the latest
binary version for your distribution, and then install it as you would any othe
r package.
Once you have Samba correctly installed, there are only a few steps to get SWAT
up and running. First, check to see whether SWAT is already running on your mach
ine by opening an XWindows session (using the startx command) and pointing your
Web browser to http://127.0.0.1:901. If successful, you will be presented with a
dialog box asking for username and password. Use the username "root" and the ro
ot password to log in. If you see a screen that looks like Figure A, you re in busin
ess. If you get an error message, you will need to do some configuration work.
To configure SWAT, you will need to do the following on most Linux distributions
. First, add the following line to your /etc/services file:
swat 901/tcp
# SWAT Samba configuration
Next, add the following line to your /etc/inted.conf file:
swat
stream tcp
nowait.400
/usr/local/samba/bin/swat swat
[Note: The path to swat may be different, according to your distribution.]
Then, locate and restart inetd (or xinetd if you are using a newer distribution)
or simply reboot. On your local machine, address your Web browser to http://127
.0.0.1:901 or http://localhost:901 and enter the root username and password.
Read this if you are using Red Hat 7.x or another distribution with xinetd
If you are running a version of Red Hat Linux 7.x or above, you have xinetd and
not inetd. If you have xinetd on Red Hat or another distribution, then you will
disregard the step listed above for inetd and instead you will need to create a
little script to work withxinetd. Check out this sample script. Also, if you are
running Red Hat 7.0, you should patch your xinetd with this bug fix since the v
ersion of xinetd included with Red Hat 7.0 does not work properly with SWAT. Thi
s link has more information on the xinetdissue.
If you connect over the network through a remote machine, you should know that y
our password will be sent in the clear. I recommend administering locally or con
necting to SWAT over an SSL connection if you decide to set it up for remote adm
inistration. Also, SWAT will overwrite your smb.conf file and remove all the val
uable comments. As a result, I highly recommend backing up your smb.conf file be
fore using SWAT. You can do this by issuing the following command from the direc
tory where your smb.conf file is located:
cp smb.conf smb.conf.original
For any problems or questions you may run into, refer to the man pages located w
ithin your distribution. The man pages for your distribution will also point out
any specific peculiarities that may exist for your distribution, as well.
Basic configuration with SWAT
When you log in to SWAT for the first time, you will see the documentation scree
n (see Figure A again). I strongly recommended looking at each section thoroughl
y. This will help you learn the basics, and it provides a great reference if you
get stuck during your configuration. The documentation also includes the text o
f a great book called Using Samba.
Now that you have SWAT up and running, you are ready to configure Samba. Let s take
a look at how you can use SWAT to administer Samba settings. However, keep in mi
nd that we re only going to cover the basics. If you want information on more advanc
ed Samba configuration, I would recommend taking a look at this HOWTO. For infor
mation on configuring Samba for integration into a Windows domain, check out "Sa
ve big by replacing NT file servers with Linux Samba."
Global variables
First, we ll take a look at the heart of any Samba configuration, the Global variabl
es. In SWAT, you can set these options by clicking on the Globals tab. You can s
ee an example of the Global variables GUI in Figure B.
This provides you with options
t to set additional variables,
setting nearly every possible
iables you will need to set in
The workgroup variable needs to be set to match the desired Windows Workgroup or
Domain and should be in all caps. The NetBIOS variable is just that, the Linux
machine s NetBIOS name on the Windows network. It should also be in all caps. This i
s the name that will show up in the Network Neighborhood of Windows machines.
If you are running Windows 98 or above, Windows NT 4.0 with SP3 or above, or Win
dows 2000, you need to make sure to have the variable use encrypted passwords=ye
s. Until you learn more advanced configuration, you can safely leave everything
else in the Global variables at the default settings.
Shares
Next, let's move to the Shares tab, shown in Figure C. Here, we make available f
iles, drives, etc., to our Windows Workgroup or Domain or to individuals. The de
fault share created is the "homes" share, and if you select that share and click
Choose Share, you can then edit as needed. This is often used to set up Samba s
hares for individual user accounts since user directories are placed in /home by
default. However, you can use the Shares section to share any directory on your
Linux machine with the Windows network. You could also create a new folder such
as /home/fileserver and share that.
Printers
Now we ll take a look at the Printers tab. Before you set up a printer share, make s
ure that you have already configured your printer on your Linux box. If are usin
g Linux-Mandrake, try out Drakconf, which has an excellent utility for adding pr
inters. Once you have your printer working and ready to be shared, you should se
e a drop-down list under the printer s section with an entry like lp or lp0. This sh
ould be the active printer. Choose this and click the Choose Printer button to b
ring up the options for this share. Make sure the printer is accessible to those
whom you intend to use it.
Samba users
The Password tab, shown in Figure D, takes you to the smbpasswd utility, which i
s used to add Samba users and to set up or change Samba passwords. You can also
disable or enable accounts as needed. To add a user, the user must already have
a local Linux user account. The easiest way to add a new Linux user account is t
o go to the command line and use the adduser command. When you type adduser user
name and press [Enter], it will prompt for a password and ask you to confirm it.
Once you finish adding the user locally, go back to the password section in SWA
T, enter the username and password, and select Add. After you add the user, make
sure to click the Enable button to enable the user.
When you ve set up all your globals, shares, printers, and users, go to the Status t
ab and start or restart the smbd and nmbd services (these are the two services t
hat run Samba). To test your configuration, go to one of the users' PCs and try
to add a Samba printer or mount a Samba share just as if it were a Windows print
er or file share. If you have problems accessing the printer or share, there is
probably a problem with one of your security settings. Refer to the Samba docume
ntation on the opening page of SWAT.