2.5 Enabling SWAT

   

The Samba Web Administration Tool (SWAT) runs as a daemon under inetd or xinetd and provides a forms-based editor in your web browser for creating and modifying Samba's configuration file. For SWAT to work, entries must be added for it in the /etc/services and /etc/inetd.conf (or /etc/xinetd.d/swat) configuration files. To add the entries, follow these two steps:

  1. Check your /etc/services file, and if it does not contain the following line, add it to the end of the file:

     swat   901/tcp 
  2. Now for inetd or xinetd. These are "Internet super daemons" that handle starting daemons on demand, instead of letting them sit around in memory consuming system resources. Most systems use inetd, but xinetd is also used in some versions of Unix, notably the Red Hat Linux (Versions 7 and newer ) that we use in our examples. You can use the ps command to see which of the two your system is running.

For inetd, add a line to the /etc/ inetd.conf file. (Check your inetd.conf manual page to see the exact format of the inetd.conf file if it differs from the following example.) Don't forget to change the path to the SWAT binary if you installed it in a different location from the default /usr/local/samba :

 swat   stream  tcp  nowait  root  /usr/local/samba/bin/swat  swat 

Then force inetd to reread its configuration file by sending it a SIGHUP (hangup) signal:

 #  /bin/kill -HUP -a inetd  

Notice that we are using a version of the kill command that supports the -a option, so as to allow us to specify the process by name . On FreeBSD and Linux, you can use the killall command [2] as follows :

[2] Do not confuse this with the Solaris killall command, which performs part of the system shutdown sequence!

 #  killall -HUP inetd  

If you are not running Linux or FreeBSD and your version of kill doesn't have the -a option, you will need to use the ps command to find the process ID and then supply that to kill :

 #  ps ax  grep inetd  780 ?        S      0:00 inetd  1981 pts/4    S      0:00 grep inetd                                          #  kill -HUP 780  

If your system is using xinet, add a file named swat in your /etc/xinetd.d directory, containing the following:

 # description: swat is the Samba Web Administration Tool, which #       allows an administrator to configure Samba using a web #       browser interface, with the URL http://localhost:901 service swat. {         socket_type             = stream         wait                    = no         protocol                = tcp         only_from               = localhost         user                    = root         log_on_failure          += USERID         server                  = /usr/local/samba/bin/swat         port                    = 901         disable                 = no } 

Then xinetd needs to be sent a signal [3] to make it reread its configuration files:

[3] Depending on the version of xinetd you have and how it was compiled, you might need to send a USR1 or some other signal rather than the HUP signal. Check the manual page for xinetd (8) on your system for details.

 #  /bin/kill -HUP -a xinetd  

And that's pretty much it for the installation. Before you can start up Samba, however, you need to create a configuration file for it.

   


Using Samba
Using Samba: A File and Print Server for Linux, Unix & Mac OS X, 3rd Edition
ISBN: 0596007698
EAN: 2147483647
Year: 2003
Pages: 475

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net