Install SWAT (Samba Web Configuration Tool) On Ubuntu 12.04 Precise Pangolin

It’s relatively easy to configure Samba 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 to install on Ubuntu 12.04 Precise Pangolin, but once you have it up and running, it’s quite simple to use.

First, you’ll need to have Samba installed before you can install SWAT.

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 12.04 Precise Pangolin 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

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.

service swat

{

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 /etc/init.d/xinetd restart

From a different client on your network, fire up a web browser. Assuming your Samba server has an IP address of 192.168.1.2, you can access SWAT here:

http://192.168.1.2:901

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.

-JM

ADDITIONAL READING:

The Ubuntu Beginner’s Guide

The Ubuntu Desktop Beginner’s Guide.

This entry was posted in Ubuntu 12.04. Bookmark the permalink.

6 Responses to Install SWAT (Samba Web Configuration Tool) On Ubuntu 12.04 Precise Pangolin

  1. Dan Cotruta says:

    Very well written tutorial :)

  2. Tim says:

    jm,

    I agree with Dan. Excellent tutorial. Swat came up first time. Beautiful. I had used it years ago when all my office shares were on a linux box, so it’s great to have swat back. (I since got a NAS that does all the tricks automatically, but it’s kinda slow, which is why I’m resurrecting Samba on a virtual box arrangement.)

    Then I hit a problem. The configuration pages are cut short. The “globals” page, for example, stops at the “Base Options” title. I thought, “hmm. maybe samba.conf isn’t accessible.” But it’s owned by root:adm and the permission list is: -rw-rw-r–. I even signed in as root to make sure it wasn’t a permissions problem. I tried the “Samba Configuration Wizard” page, which actually shows options. But “commit” but just clears the page and the options I chose are apparently not saved.

    Any idea how what’s going on here?

    tp

  3. Russ says:

    Tim – I was having what I believe is the same problem and I believe I found a solution. In some extensive Googling on the issue, it appears there is a problem in the libpam-smbpass package which, as far as I can tell, is used to keep Linux and Samba users and passwords in sync with each other.

    As to how I found out it’s a potential source of the problem, look here: https://bugzilla.samba.org/show_bug.cgi?id=8999

    So I uninstalled the package using sudo apt-get remove libpam-smbpass and I’m able to access everything via SWAT and my Samba shares still work. I was using Webmin to change settings on my Ubuntu server and one of the options was to sync Linux users with Samba users which is what I’m guessing messed everything up. Anyway, hope you find it helpful and thanks to JM for this helpful tutorial!

  4. Pete says:

    Right, the so many-th useless tool in Linux.
    It is not more or less than an easy way to access documentation.
    Half of the buttons that should be there in the interface are missing.
    Even a decent logout button is missing.
    The tool says everything is all right (while it isn’t because shares are not accessible).
    And on top of it you can access it from outside if your firewall is wrongly configured, so it is a safety hazard.

    Why is Ubuntu still releasing tools that don’t work and that require commandline knowledge anyway?
    This tool is just a waste of space with no added value.

  5. Jay says:

    I used Russ’ solution of removing the libpam-smbpass on Ubuntu 12.10 and it fixed my problem as well.

    sudo apt-get remove libpam-smbpass

    Thanks!
    Jay

  6. Henning says:

    Yes, removing the libpam-smbpass allows to configure the samba server via swat again, but if you do not like to maintenance the smbpasswd separately, this seems not to be a good idea!
    On the other hand I need SWAT for a quick check of the documentation for any option.
    It’s a pity, that this great tool seems to be no more maintained.
    Henning