1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE chapter PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
6 <pubdate>April 21, 2003</pubdate>
9 <title>SWAT &smbmdash; The Samba Web Administration Tool</title>
12 There are many and varied opinions regarding the usefulness of SWAT.
13 No matter how hard one tries to produce the perfect configuration tool, it remains
14 an object of personal taste. SWAT is a tool that will allow Web-based configuration
15 of Samba. It has a wizard that may help to get Samba configured
16 quickly, it has context-sensitive help on each &smb.conf; parameter, it provides for monitoring of current state
17 of connection information, and it allows network-wide MS Windows network password
22 <title>Features and Benefits</title>
25 SWAT is a facility that is part of the Samba suite. The main executable is called
26 <command>swat</command> and is invoked by the inter-networking super daemon.
27 See <link linkend="xinetd">appropriate section</link> for details.
31 SWAT uses integral samba components to locate parameters supported by the particular
32 version of Samba. Unlike tools and utilities that are external to Samba, SWAT is always
33 up to date as known Samba parameters change. SWAT provides context-sensitive help for each
34 configuration parameter, directly from <command>man</command> page entries.
38 There are network administrators who believe that it is a good idea to write systems
39 documentation inside configuration files, and for them SWAT will always be a nasty tool. SWAT
40 does not store the configuration file in any intermediate form, rather, it stores only the
41 parameter settings, so when SWAT writes the &smb.conf; file to disk, it will write only
42 those parameters that are at other than the default settings. The result is that all comments,
43 as well as parameters that are no longer supported, will be lost from the &smb.conf; file.
44 Additionally, the parameters will be written back in internal ordering.
48 Before using SWAT, please be warned &smbmdash; SWAT will completely replace your &smb.conf; with
49 a fully-optimized file that has been stripped of all comments you might have placed there
50 and only non-default settings will be written to the file.
56 <title>Guidelines and Technical Tips</title>
59 This section aims to unlock the dark secrets behind how SWAT may be made to work,
60 may be made more secure, and how to solve Internationalization support problems.
64 <title>Validate SWAT Installation</title>
67 The very first step that should be taken before attempting to configure a host
68 system for SWAT operation is to check that it is installed. This may seem a trivial
69 point to some, however several Linux distributions do not install SWAT by default,
70 even though they do ship an install-able binary support package containing SWAT
71 on the distribution media.
75 When you have confirmed that SWAT is installed it is necessary to validate
76 that the installation includes the binary <command>swat</command> file as well
77 as all the supporting text and Web files. A number of operating system distributions
78 in the past have failed to include the necessary support files, even though the
79 <command>swat</command> binary executable file was installed.
83 Finally, when you are sure that SWAT has been fully installed, please check the SWAT
84 has been enabled in the control file for the inter-networking super-daemon (inetd or xinetd)
85 that is used on your operating system platform.
89 <title>Locating the <command>swat</command> File</title>
92 To validate that SWAT is installed, first locate the <command>swat</command> binary
93 file on the system. It may be found under the following directories:
95 <member><filename>/usr/local/samba/bin</filename> &smbmdash; the default Samba location.</member>
96 <member><filename>/usr/sbin</filename> &smbmdash; the default location on most Linux systems.</member>
97 <member><filename>/opt/samba/bin</filename></member>
102 The actual location is much dependant on the choice of the operating system vendor, or as determined
103 by the administrator who compiled and installed Samba.
107 There are a number methods that may be used to locate the <command>swat</command> binary file.
108 The following methods may be helpful:
112 If <command>swat</command> is in your current operating system search path it will be easy to
113 find it. You can ask what are the command-line options for <command>swat</command> as shown here:
116 Usage: swat [OPTION...]
117 -a, --disable-authentication Disable authentication (demo mode)
120 -?, --help Show this help message
121 --usage Display brief usage message
123 Common samba options:
124 -d, --debuglevel=DEBUGLEVEL Set debug level
125 -s, --configfile=CONFIGFILE Use alternative configuration file
126 -l, --log-basename=LOGFILEBASE Basename for log/debug files
127 -V, --version Print version
134 <title>Locating the SWAT Support Files</title>
137 Now that you have found that <command>swat</command> is in the search path, it is easy
138 to identify where the file is located. Here is another simple way this may be done:
140 frodo:~ # whereis swat
141 swat: /usr/sbin/swat /usr/share/man/man8/swat.8.gz
146 If the above measures fail to locate the <command>swat</command> binary, another approach
147 is needed. The following may be used:
149 frodo:/ # find / -name swat -print
152 /usr/share/samba/swat
158 This list shows that there is a control file for <command>xinetd</command>, the internetwork
159 super-daemon that is installed on this server. The location of the SWAT binary file is
160 <filename>/usr/sbin/swat</filename>, and the support files for it are located under the
161 directory <filename>/usr/share/samba/swat</filename>.
165 We must now check where <command>swat</command> expects to find its support files. This can
168 frodo:/ # strings /usr/sbin/swat | grep "/swat"
171 /usr/share/samba/swat
177 The <filename>/usr/share/samba/swat/</filename> entry shown in this listing is the location of the
178 support files. You should verify that the support files exist under this directory. A sample
181 jht@frodo:/> find /usr/share/samba/swat -print
182 /usr/share/samba/swat
183 /usr/share/samba/swat/help
184 /usr/share/samba/swat/lang
185 /usr/share/samba/swat/lang/ja
186 /usr/share/samba/swat/lang/ja/help
187 /usr/share/samba/swat/lang/ja/help/welcome.html
188 /usr/share/samba/swat/lang/ja/images
189 /usr/share/samba/swat/lang/ja/images/home.gif
191 /usr/share/samba/swat/lang/ja/include
192 /usr/share/samba/swat/lang/ja/include/header.nocss.html
194 /usr/share/samba/swat/lang/tr
195 /usr/share/samba/swat/lang/tr/help
196 /usr/share/samba/swat/lang/tr/help/welcome.html
197 /usr/share/samba/swat/lang/tr/images
198 /usr/share/samba/swat/lang/tr/images/home.gif
200 /usr/share/samba/swat/lang/tr/include
201 /usr/share/samba/swat/lang/tr/include/header.html
202 /usr/share/samba/swat/using_samba
204 /usr/share/samba/swat/images
205 /usr/share/samba/swat/images/home.gif
207 /usr/share/samba/swat/include
208 /usr/share/samba/swat/include/footer.html
209 /usr/share/samba/swat/include/header.html
215 If the files needed are not available it will be necessary to obtain and install them
216 before SWAT can be used.
223 <title>Enabling SWAT for Use</title>
226 SWAT should be installed to run via the network super-daemon. Depending on which system
227 your UNIX/Linux system has, you will have either an <command>inetd</command>- or
228 <command>xinetd</command>-based system.
232 The nature and location of the network super-daemon varies with the operating system
233 implementation. The control file (or files) can be located in the file
234 <filename>/etc/inetd.conf</filename> or in the directory <filename>/etc/[x]inet[d].d</filename>
239 The control entry for the older style file might be:
240 <indexterm><primary>swat</primary><secondary>enable</secondary></indexterm>
244 <para><programlisting>
245 # swat is the Samba Web Administration Tool
246 swat stream tcp nowait.400 root /usr/sbin/swat swat
247 </programlisting></para>
250 A control file for the newer style xinetd could be:
254 <smbfile name="xinetd.swat">
257 # description: SWAT is the Samba Web Admin Tool. Use swat \
258 # to configure your Samba server. To use SWAT, \
259 # connect to port 901 with your favorite web browser.
265 only_from = localhost
267 server = /usr/sbin/swat
268 log_on_failure += USERID
273 In the above, the default setting for <parameter>disable</parameter> is <constant>yes</constant>.
274 This means that SWAT is disabled. To enable use of SWAT, set this parameter to <constant>no</constant>
279 Both of the above examples assume that the <command>swat</command> binary has been
280 located in the <filename>/usr/sbin</filename> directory. In addition to the above,
281 SWAT will use a directory access point from which it will load its Help files
282 as well as other control information. The default location for this on most Linux
283 systems is in the directory <filename>/usr/share/samba/swat</filename>. The default
284 location using Samba defaults will be <filename>/usr/local/samba/swat</filename>.
288 Access to SWAT will prompt for a logon. If you log onto SWAT as any non-root user,
289 the only permission allowed is to view certain aspects of configuration as well as
290 access to the password change facility. The buttons that will be exposed to the non-root
291 user are: <guibutton>HOME</guibutton>, <guibutton>STATUS</guibutton>, <guibutton>VIEW</guibutton>,
292 <guibutton>PASSWORD</guibutton>. The only page that allows
293 change capability in this case is <guibutton>PASSWORD</guibutton>.
297 As long as you log onto SWAT as the user <emphasis>root</emphasis>, you should obtain
298 full change and commit ability. The buttons that will be exposed include:
299 <guibutton>HOME</guibutton>, <guibutton>GLOBALS</guibutton>, <guibutton>SHARES</guibutton>, <guibutton>PRINTERS</guibutton>,
300 <guibutton>WIZARD</guibutton>, <guibutton>STATUS</guibutton>, <guibutton>VIEW</guibutton>, <guibutton>PASSWORD</guibutton>.
306 <title>Securing SWAT through SSL</title>
310 <indexterm><primary>swat</primary><secondary>security</secondary></indexterm>
311 Many people have asked about how to setup SWAT with SSL to allow for secure remote
312 administration of Samba. Here is a method that works, courtesy of Markus Krieger.
316 Modifications to the SWAT setup are as follows:
325 Generate certificate and private key.
328 &rootprompt;<userinput>/usr/bin/openssl req -new -x509 -days 365 -nodes -config \
329 /usr/share/doc/packages/stunnel/stunnel.cnf \
330 -out /etc/stunnel/stunnel.pem -keyout /etc/stunnel/stunnel.pem</userinput>
331 </screen></para></step>
334 Remove swat-entry from [x]inetd.
338 Start <command>stunnel</command>.
341 &rootprompt;<userinput>stunnel -p /etc/stunnel/stunnel.pem -d 901 \
342 -l /usr/local/samba/bin/swat swat </userinput>
343 </screen></para></step>
347 Afterward, simply connect to swat by using the URL <ulink noescape="1" url="https://myhost:901">https://myhost:901</ulink>, accept the certificate
348 and the SSL connection is up.
354 <title>Enabling SWAT Internationalization Support</title>
357 SWAT can be configured to display its messages to match the settings of
358 the language configurations of your Web browser. It will be passed to SWAT
359 in the Accept-Language header of the HTTP request.
363 To enable this feature:
368 Install the proper <command>msg</command> files from the Samba
369 <filename>source/po</filename> directory into $LIBDIR.
373 Set your browsers language setting.
378 The name of msg file is same as the language ID sent by the browser. For
379 example en means "English", ja means "Japanese", fr means "French.
383 If you do not like some of messages, or there are no <command>msg</command> files for
384 your locale, you can create them simply by copying the <command>en.msg</command> files
385 to the directory for <quote>your language ID.msg</quote> and filling in proper strings
386 to each <quote>msgstr</quote>. For example, in <filename>it.msg</filename>, the
387 <command>msg</command> file for the Italian locale, just set:
390 msgstr "Imposta Default"
392 and so on. If you find a mistake or create a new <command>msg</command> file, please email it
393 to us so we will include this in the next release of Samba. The <command>msg</command> file should be encoded in UTF-8.
397 Note that if you enable this feature and the <smbconfoption name="display charset"/> is not
398 matched to your browsers setting, the SWAT display may be corrupted. In a future version of
399 Samba, SWAT will always display messages with UTF-8 encoding. You will then not need to set
400 this &smb.conf; file parameter.
408 <title>Overview and Quick Tour</title>
411 SWAT is a tools that many be used to configure Samba, or just to obtain useful links
412 to important reference materials such as the contents of this book, as well as other
413 documents that have been found useful for solving Windows networking problems.
417 <title>The SWAT Home Page</title>
420 The SWAT title page provides access to the latest Samba documentation. The manual page for
421 each Samba component is accessible from this page, as are the Samba HOWTO-Collection (this
422 document) as well as the O'Reilly book <quote>Using Samba.</quote>
426 Administrators who wish to validate their Samba configuration may obtain useful information
427 from the man pages for the diagnostic utilities. These are available from the SWAT home page
428 also. One diagnostic tool that is not mentioned on this page, but that is particularly
429 useful is <ulink url="http://www.ethereal.com/"><command>ethereal</command>.</ulink>
433 SWAT can be configured to run in <emphasis>demo</emphasis> mode. This is not recommended
434 as it runs SWAT without authentication and with full administrative ability. Allows
435 changes to &smb.conf; as well as general operation with root privileges. The option that
436 creates this ability is the <option>-a</option> flag to swat. <emphasis>Do not use this in a
437 production environment.</emphasis>
443 <title>Global Settings</title>
446 The <guibutton>GLOBALS</guibutton> button will expose a page that allows configuration of the global parameters
447 in &smb.conf;. There are two levels of exposure of the parameters:
452 <guibutton>Basic</guibutton> &smbmdash; exposes common configuration options.
456 <guibutton>Advanced</guibutton> &smbmdash; exposes configuration options needed in more
457 complex environments.
462 To switch to other than <guibutton>Basic</guibutton> editing ability, click on <guibutton>Advanced</guibutton>.
463 You may also do this by clicking on the radio button, then click on the <guibutton>Commit Changes</guibutton> button.
467 After making any changes to configuration parameters, make sure that
469 <guibutton>Commit Changes</guibutton> button before moving to another area, otherwise
470 your changes will be lost.
474 SWAT has context-sensitive help. To find out what each parameter is
475 for, simply click on the
476 <guibutton>Help</guibutton> link to the left of the configuration parameter.
482 <title>Share Settings</title>
485 To effect a currently configured share, simply click on the pull down button between the
486 <guibutton>Choose Share</guibutton> and the <guibutton>Delete Share</guibutton> buttons,
487 select the share you wish to operate on, then to edit the settings
489 <guibutton>Choose Share</guibutton> button. To delete the share, simply press the
490 <guibutton>Delete Share</guibutton> button.
494 To create a new share, next to the button labeled <guibutton>Create Share</guibutton> enter
495 into the text field the name of the share to be created, then click on the
496 <guibutton>Create Share</guibutton> button.
502 <title>Printers Settings</title>
505 To affect a currently configured printer, simply click on the pull down button between the
506 <guibutton>Choose Printer</guibutton> and the <guibutton>Delete Printer</guibutton> buttons,
507 select the printer you wish to operate on, then to edit the settings
509 <guibutton>Choose Printer</guibutton> button. To delete the share, simply press the
510 <guibutton>Delete Printer</guibutton> button.
514 To create a new printer, next to the button labeled <guibutton>Create Printer</guibutton> enter
515 into the text field the name of the share to be created, then click on the
516 <guibutton>Create Printer</guibutton> button.
522 <title>The SWAT Wizard</title>
525 The purpose if the SWAT Wizard is to help the Microsoft-knowledgeable network administrator
526 to configure Samba with a minimum of effort.
530 The Wizard page provides a tool for rewriting the &smb.conf; file in fully optimized format.
531 This will also happen if you press the <guibutton>Commit</guibutton> button. The two differ
532 since the <guibutton>Rewrite</guibutton> button ignores any changes that may have been made,
533 while the <guibutton>Commit</guibutton> button causes all changes to be affected.
537 The <guibutton>Edit</guibutton> button permits the editing (setting) of the minimal set of
538 options that may be necessary to create a working Samba server.
542 Finally, there are a limited set of options that will determine what type of server Samba
543 will be configured for, whether it will be a WINS server, participate as a WINS client, or
544 operate with no WINS support. By clicking one button, you can elect to expose (or not) user
551 <title>The Status Page</title>
554 The status page serves a limited purpose. First, it allows control of the Samba daemons.
555 The key daemons that create the Samba server environment are: &smbd;, &nmbd;, &winbindd;.
559 The daemons may be controlled individually or as a total group. Additionally, you may set
560 an automatic screen refresh timing. As MS Windows clients interact with Samba, new smbd processes
561 will be continually spawned. The auto-refresh facility will allow you to track the changing
562 conditions with minimal effort.
566 Lastly, the Status page may be used to terminate specific smbd client connections in order to
567 free files that may be locked.
573 <title>The View Page</title>
576 This page allows the administrator to view the optimized &smb.conf; file and, if you are
577 particularly masochistic, will permit you also to see all possible global configuration
578 parameters and their settings.
584 <title>The Password Change Page</title>
587 The Password Change page is a popular tool that allows the creation, deletion, deactivation,
588 and reactivation of MS Windows networking users on the local machine. Alternately, you can use
589 this tool to change a local password for a user account.
593 When logged in as a non-root account, the user will have to provide the old password as well as
594 the new password (twice). When logged in as <emphasis>root</emphasis>, only the new password is
599 One popular use for this tool is to change user passwords across a range of remote MS Windows