How to get Samba SWAT working on Ubuntu

The file sharing built into Nautilus in Ubuntu has confused me for a while: I don’t think it’s ever worked correctly on our network. Setting up Samba on the other hand was relatively easy, but hard to configure correctly (there are an enormous number of options and no easy user guide).

Today I finally decided to fix my half-baked Samba setup and install SWAT (a Samba GUI) to manage it. However, it wasn’t all smooth sailing. After installing SWAT I discovered that I couldn’t log into it. Instead, I would get a “Connection Reset” error in my web-browser whenever I tried to connect to the SWAT config page on my machine. After a little investigation I discovered that although SWAT was configured to only accept connections from this machine (localhost), somewhere along the line it was getting confused about where I was connecting from and rejecting my request. But if I changed the config to accept connections to 127.0.0.1 (the ip address for localhost) then I was able to connect.

Once I’d fixed that issue I ran into another: SWAT wouldn’t let me change any settings. It was read-only when I logged in with my sudo-enabled account. It seems that SWAT will let any user log in, but only  root can actually change the settings (which is annoying because on Ubuntu the root user is disabled by default – and for good reasons). Unfortunately I haven’t found a way around this, and it seems that there are no plans to fix it in Ubuntu for the time being (it’s a design feature, not a bug, apparently).

Solution

If you can’t connect to SWAT, check if

only_from=localhost

is set in /etc/xinetd.d/swat (it’s in the default configuration suggested in the Samba manual). If it’s set to localhost, try changing it to

only_from=127.0.0.1

instead and restarting SWAT (using sudo /etc/init.d/xinetd restart).

Also, SWAT will only allow the root user to change settings. To enable the root user in Ubuntu, set the root users’s password by running

sudo passwd root

Then to log into SWAT using the these details. You might want to run

sudo passwd -l root

afterwards to disable the root account again.

Advertisements

About this entry