It’s relatively easy to configure Samba on Ubuntu 11.04 Natty Narwhal using command-line tools and by editing the /etc/samba/smb.conf file. However, the learning curve is rather sharp. If you want a more graphical interface, there’s a program called SWAT, the Samba Web Administration Tool. SWAT allows you to administer your Samba server through a web interface. SWAT is a fairly complicated program, but once you have it up and running, it’s quite simple to use.
Obviously, you’ll need to have Samba installed before you can install SWAT. If you haven’t installed Samba, here’s a quick guide on how to do it.
Once you have Samba installed, you’ll need to pick an account that is a member of the local admin group, since you’ll need an account with admin-level permissions to use all of SWAT’s functions (otherwise you’ll only see status pages, and will be unable to change any settings). The default account you created during the installation of Ubuntu belongs to the local admin group, so that account will work. Make sure the admin group has permission to the /etc/samba/smb.conf file with these commands:
sudo chmod g+w /etc/samba/smb.conf
sudo chgrp adm /etc/samba/smb.conf
Next, install both SWAT and the inetd Internet superserver, which is required for SWAT to run properly (inetd is sort of a “super-process” that can control and call lesser processes):
sudo apt-get install swat xinetd
This will install SWAT and the inetd superserver, and their dependencies. Once the installation has finished, you’ll need to create a configuration file for SWAT in the /etc/xinetd.d directory. Fortunately, you can do that quite handily with vi:
sudo vi /etc/xinetd.d/swat
(If you’re using the desktop version of Ubuntu, you can also use gedit or another graphical editor.)
Once you’re in the swat file, switch vi to Insert mode add this text:
# default: off
# description: SWAT is the Samba Web Admin Tool. Use swat \
# to configure your Samba server. To use SWAT, \
# connect to port 901 with your favorite web browser.
port = 901
socket_type = stream
wait = no
# Use only_from if you want to restrict access
# only_from = localhost
user = root
server = /usr/sbin/swat
log_on_failure += USERID
disable = no
Note that there must be a space before and after the equal signs.
After you’ve added the text, switch back to Command mode, save the file, exit vi, and use this command to restart the inetd server:
sudo service xinetd restart
From a different client on your network, fire up a web browser. Assuming your Samba server as an IP address of 192.168.1.2, you can access SWAT here:
Enter a username and a password from the admin group, and you’ll have access to SWAT.
Note that SWAT also includes all of Samba’s man pages in easily-read web page format.