From the swat man page: swat allows a Samba administrator to configure the complex smb.conf file via a Web browser. In addition, a swat configuration page has help links to all the configurable options in the smb.conf file allowing an administrator to easily look up the effects of any change.
Installing and running Samba is outside the scope of this document.
How to actually use Swat is outside the scope of this document, but http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/SWAT.html#id2651818 is a good place to get started.
Installing Swat
sudo apt-get install swat xinetd
sudo nano /etc/xinetd.d/swat
Insert the following text (borrowed from http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/SWAT.html#xinetd):
# 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 only_from = localhost user = root server = /usr/sbin/swat log_on_failure += USERID disable = no }
- Exit and Save
Running Swat
-
Invoke an init script (depreciated) sudo /etc/init.d/xinetd restart
or use the services utility sudo service xinetd restart
Point your browser to http://localhost:901/
- Enter the username and password of a user with proper privileges
Questions
Q: The swat help links do not work. How do I tell swat where to find the man pages?
A: You don’t have to tell swat where they are you have to install them.
sudo apt-get install samba-doc
Q: When I open the web page I only see four boxes (Home, Status, View, Password) but none of these boxes give me the ability to configure Samba. What should I do?
A: You do not have the necessary permissions. You will need to ensure you are a user of the administration group (‘admin’) and that the adm group has sufficient access rights to the Samba configuration file (‘smb.conf’). Note the user created during the installation is automatically a member of the adm group.
To ensure the adm group has proper permissions over ‘smb.conf’ use ‘chmod’ and ‘chgrp’ tools to change the file access permissions and group permissions respectively:
sudo chmod g+w /etc/samba/smb.conf sudo chgrp adm /etc/samba/smb.conf
Another method is to grant all users—the whole world essentially—complete access to ‘smb.conf’. This is not recommended for obvious security reasons.
sudo chmod 777 /etc/samba/smb.conf
Now refresh your browser window and you should see additional boxes for Globals, Shares, Printers and Wizard.
Q: On my 6.06 LTS server clients don't see the swat page. It is just a blank page. What now?
A: Edit the /etc/samba/smb.conf file so that the file contains a line for allowed hosts like:
sudo vi /etc/samba/smb.conf
or, if you are not that comfortable with vi:
sudo nano /etc/samba/smb.conf
Add or change the following line:
[global] ...... ....... hosts allow = 192.168.1.0/255.255.255.0 [printers]
Of course this has to match your own network settings. After this you have to restart the samba subsystem.
sudo /etc/init.d/samba restart
Q: On my 9.04 Server i can't access swat. If I test with ss -lt there is a line with
... LISTEN 0 0 :::swat :::* ...
A: Swat seems to be bound to IPv6 instead of IPv4 A2: IPv6 sockets include IPv4 connectivity by default (unless turned off by the process).
Edit the following line with sudo nano /etc/inetd.conf
swat stream tcp nowait.400 root /usr/sbin/tcpd /usr/sbin/swat
into
swat stream tcp4 nowait.400 root /usr/sbin/tcpd /usr/sbin/swat
then restart inetd with sudo /etc/init.d/inetutils-inetd restart