Linux - Samba - The Samba Web Administration Tool (swap)

> Operating System - Kernel (Windows, Unix, Linux) > Linux / Unix

1 - About

SWAT is a web-based application that help to configure Samba. Swap is installed with the installation of samba.

3 - How to

3.1 - Get the version

You can verify the installation by performing this command : swat -?

[root@oel11g ~]# swat -?
Usage: swat [OPTION...]
  -a, --disable-authentication       Disable authentication (demo mode)
  -P, --password-menu-only           Show only change password menu
 
Help options:
  -?, --help                         Show this help message
  --usage                            Display brief usage message
 
Common samba options:
  -d, --debuglevel=DEBUGLEVEL        Set debug level
  -s, --configfile=CONFIGFILE        Use alternate configuration file
  -l, --log-basename=LOGFILEBASE     Base name for log files
  -V, --version                      Print version

swat answer with the help message.

Advertising

3.2 - Locate it

[[email protected] ~]# whereis swat
swat: /usr/sbin/swat /usr/share/swat /usr/share/man/man8/swat.8.gz

or

[[email protected] ~]# find / -name swat -print
/usr/share/swat
/usr/sbin/swat
/etc/xinetd.d/swat

3.3 - Enable it

To enable it, you must modify the file swat located in /etc/xinetd.d/swat by setting no in front of the disable option as :

# 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       = 192.168.2.82 localhost
	user            = root
	server          = /usr/sbin/swat
        server_args     = -a
	log_on_failure += USERID
	disable         = no
}

where:

  • port is the port of the web administration tool
  • server is the location of the swat binary (locate it)
  • server_args are the argument of the server. Here -a to disable authentication ;-)
  • disable must set to no to enable

It's a control file with the new style xinetd.

In order to launch your modification, you must restart the xinetd Linux - (Services|Daemon).

[root@oel11g ~]# service xinetd restart
Stopping xinetd:                                           [  OK  ]
Starting xinetd:                                           [  OK  ]

Once the restart is successful, Swat is accessible via the web-address http://localhost:901. You have to login with the root user.

Advertising

4 - Support

By default, xinetd use SYSLOG to log the message. Then to debug, just restart xinetd and check the messages log with the command below.

tail -f /var/log/messages

Example of problem that you can found:

Jun 12 18:54:27 di-obia-01 xinetd[9696]: Bad value for wait: on [file=/etc/xinetd.d/swat] [line=9]
Jun 12 18:54:27 di-obia-01 xinetd[9696]: Error parsing attribute wait - DISABLING SERVICE [file=/etc/xinetd.d/swat] [line=9]
Jun 12 18:54:27 di-obia-01 xinetd[9696]: attribute server expects 1 values and 2 values were specified [file=/etc/xinetd.d/swat] [line=12]
Jun 12 18:54:27 di-obia-01 xinetd[9696]: Must specify a server in swat

5 - Documentation / Reference

os/linux/samba_swap.txt · Last modified: 2018/09/16 12:42 by gerardnico