4 <pubdate>April 21, 2003</pubdate>
7 <title>SWAT - The Samba Web Administration Tool</title>
10 There are many and varied opinions regarding the usefulness or otherwise of SWAT.
11 No matter how hard one tries to produce the perfect configuration tool it remains
12 an object of personal taste. SWAT is a tool that will allow web based configuration
13 of samba. It has a wizard that may help to get samba configured quickly, it has context
14 sensitive help on each smb.conf parameter, it provides for monitoring of current state
15 of connection information, and it allows network wide MS Windows network password
20 <title>Features and Benefits</title>
23 There are network administrators who believe that it is a good idea to write systems
24 documentation inside configuration files, for them SWAT will aways be a nasty tool. SWAT
25 does not store the configuration file in any intermediate form, rather, it stores only the
26 parameter settings, so when SWAT writes the smb.conf file to disk it will write only
27 those parameters that are at other than the default settings. The result is that all comments
28 will be lost from the &smb.conf; file. Additionally, the parameters will be written back in
33 So before using SWAT please be warned - SWAT will completely replace your smb.conf with
34 a fully optimised file that has been stripped of all comments you might have placed there
35 and only non-default settings will be written to the file.
39 <title>Enabling SWAT for use</title>
42 SWAT should be installed to run via the network super daemon. Depending on which system
43 your Unix/Linux system has you will have either an <command>inetd</command> or
44 <command>xinetd</command> based system.
48 The nature and location of the network super-daemon varies with the operating system
49 implementation. The control file (or files) can be located in the file
50 <filename>/etc/inetd.conf</filename> or in the directory <filename>/etc/[x]inet.d</filename>
55 The control entry for the older style file might be:
58 <para><programlisting>
59 # swat is the Samba Web Administration Tool
60 swat stream tcp nowait.400 root /usr/sbin/swat swat
61 </programlisting></para>
64 A control file for the newer style xinetd could be:
70 # description: SWAT is the Samba Web Admin Tool. Use swat \
71 # to configure your Samba server. To use SWAT, \
72 # connect to port 901 with your favorite web browser.
80 server = /usr/sbin/swat
81 log_on_failure += USERID
89 Both the above examples assume that the <command>swat</command> binary has been
90 located in the <filename>/usr/sbin</filename> directory. In addition to the above
91 SWAT will use a directory access point from which it will load it's help files
92 as well as other control information. The default location for this on most Linux
93 systems is in the directory <filename>/usr/share/samba/swat</filename>. The default
94 location using samba defaults will be <filename>/usr/local/samba/swat</filename>.
98 Access to SWAT will prompt for a logon. If you log onto SWAT as any non-root user
99 the only permission allowed is to view certain aspects of configuration as well as
100 access to the password change facility. The buttons that will be exposed to the non-root
101 user are: <guibutton>HOME</guibutton>, <guibutton>STATUS</guibutton>, <guibutton>VIEW</guibutton>,
102 <guibutton>PASSWORD</guibutton>. The only page that allows
103 change capability in this case is <guibutton>PASSWORD</guibutton>.
107 So long as you log onto SWAT as the user <emphasis>root</emphasis> you should obtain
108 full change and commit ability. The buttons that will be exposed includes:
109 <guibutton>HOME</guibutton>, <guibutton>GLOBALS</guibutton>, <guibutton>SHARES</guibutton>, <guibutton>PRINTERS</guibutton>,
110 <guibutton>WIZARD</guibutton>, <guibutton>STATUS</guibutton>, <guibutton>VIEW</guibutton>, <guibutton>PASSWORD</guibutton>.
116 <title>Securing SWAT through SSL</title>
119 Lots of people have asked about how to setup SWAT with SSL to allow for secure remote
120 administration of Samba. Here is a method that works, courtesy of Markus Krieger
124 Modifications to the swat setup are as following:
133 generate certificate and private key
136 &rootprompt;<userinput>/usr/bin/openssl req -new -x509 -days 365 -nodes -config \
137 /usr/share/doc/packages/stunnel/stunnel.cnf \
138 -out /etc/stunnel/stunnel.pem -keyout /etc/stunnel/stunnel.pem</userinput>
139 </screen></para></step>
142 remove swat-entry from [x]inetd
149 &rootprompt;<userinput>stunnel -p /etc/stunnel/stunnel.pem -d 901 \
150 -l /usr/local/samba/bin/swat swat </userinput>
151 </screen></para></step>
155 afterwords simply contact to swat by using the URL <ulink url="https://myhost:901">https://myhost:901</ulink>, accept the certificate
156 and the SSL connection is up.
162 <title>The SWAT Home Page</title>
165 The SWAT title page provides access to the latest Samba documentation. The manual page for
166 each samba component is accessible from this page as are the Samba-HOWTO-Collection (this
167 document) as well as the O'Reilly book "Using Samba".
171 Administrators who wish to validate their samba configuration may obtain useful information
172 from the man pages for the diagnostic utilities. These are available from the SWAT home page
173 also. One diagnostic tool that is NOT mentioned on this page, but that is particularly
174 useful is <command>ethereal</command>, available from <ulink url="http://www.ethereal.com">
175 http://www.ethereal.com</ulink>.
179 SWAT can be configured to run in <emphasis>demo</emphasis> mode. This is NOT recommended
180 as it runs SWAT without authentication and with full administrative ability. ie: Allows
181 changes to smb.conf as well as general operation with root privileges. The option that
182 creates this ability is the <option>-a</option> flag to swat. <emphasis>Do not use this in any
183 production environment.</emphasis>
189 <title>Global Settings</title>
192 The Globals button will expose a page that allows configuration of the global parameters
193 in smb.conf. There are three levels of exposure of the parameters:
198 <emphasis>Basic</emphasis> - exposes common configuration options.
202 <emphasis>Advanced</emphasis> - exposes configuration options needed in more
203 complex environments.
207 <emphasis>Developer</emphasis> - exposes configuration options that only the brave
208 will want to tamper with.
213 To switch to other than <emphasis>Basic</emphasis> editing ability click on either the
214 <emphasis>Advanced</emphasis> or the <emphasis>Developer</emphasis> dial, then click the
215 <guibutton>Commit Changes</guibutton> button.
219 After making any changes to configuration parameters make sure that you click on the
220 <guibutton>Commit Changes</guibutton> button before moving to another area otherwise
221 your changes will be immediately lost.
225 SWAT has context sensitive help. To find out what each parameter is for simply click the
226 <guibutton>Help</guibutton> link to the left of the configuration parameter.
232 <title>Share Settings</title>
235 To affect a currently configured share, simply click on the pull down button between the
236 <guibutton>Choose Share</guibutton> and the <guibutton>Delete Share</guibutton> buttons,
237 select the share you wish to operate on, then to edit the settings click on the
238 <guibutton>Choose Share</guibutton> button, to delete the share simply press the
239 <guibutton>Delete Share</guibutton> button.
243 To create a new share, next to the button labelled <guibutton>Create Share</guibutton> enter
244 into the text field the name of the share to be created, then click on the
245 <guibutton>Create Share</guibutton> button.
251 <title>Printers Settings</title>
254 To affect a currently configured printer, simply click on the pull down button between the
255 <guibutton>Choose Printer</guibutton> and the <guibutton>Delete Printer</guibutton> buttons,
256 select the printer you wish to operate on, then to edit the settings click on the
257 <guibutton>Choose Printer</guibutton> button, to delete the share simply press the
258 <guibutton>Delete Printer</guibutton> button.
262 To create a new printer, next to the button labelled <guibutton>Create Printer</guibutton> enter
263 into the text field the name of the share to be created, then click on the
264 <guibutton>Create Printer</guibutton> button.
270 <title>The SWAT Wizard</title>
273 The purpose if the SWAT Wizard is to help the Microsoft knowledgeable network administrator
274 to configure Samba with a minimum of effort.
278 The Wizard page provides a tool for rewriting the smb.conf file in fully optimised format.
279 This will also happen if you press the commit button. The two differ in the the rewrite button
280 ignores any changes that may have been made, while the Commit button causes all changes to be
285 The <guibutton>Edit</guibutton> button permits the editing (setting) of the minimal set of
286 options that may be necessary to create a working Samba server.
290 Finally, there are a limited set of options that will determine what type of server Samba
291 will be configured for, whether it will be a WINS server, participate as a WINS client, or
292 operate with no WINS support. By clicking on one button you can elect to expose (or not) user
299 <title>The Status Page</title>
302 The status page serves a limited purpose. Firstly, it allows control of the samba daemons.
303 The key daemons that create the samba server environment are: &smbd;, &nmbd;, &winbindd;.
307 The daemons may be controlled individually or as a total group. Additionally, you may set
308 an automatic screen refresh timing. As MS Windows clients interact with Samba new smbd processes
309 will be continually spawned. The auto-refresh facility will allow you to track the changing
310 conditions with minimal effort.
314 Lastly, the Status page may be used to terminate specific smbd client connections in order to
315 free files that may be locked.
321 <title>The View Page</title>
324 This page allows the administrator to view the optimised &smb.conf; file and, if you are
325 particularly masochistic, will permit you also to see all possible global configuration
326 parameters and their settings.
332 <title>The Password Change Page</title>
335 The Password Change page is a popular tool. This tool allows the creation, deletion, deactivation
336 and reactivation of MS Windows networking users on the local machine. Alternatively, you can use
337 this tool to change a local password for a user account.
341 When logged in as a non-root account the user will have to provide the old password as well as
342 the new password (twice). When logged in as <emphasis>root</emphasis> only the new password is
347 One popular use for this tool is to change user passwords across a range of remote MS Windows