Relocate name lookup info to correct section.
[Samba.git] / docs / Samba-HOWTO-Collection / SWAT.xml
blob6a67db2418e8b2a2f27381e4059170c88f24b7f4
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3                 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
4   <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
5   %global_entities;
6 ]>
7 <chapter id="SWAT">
8 <chapterinfo>
9         &author.jht;
10         <pubdate>April 21, 2003</pubdate>
11 </chapterinfo>
13 <title>SWAT &smbmdash; The Samba Web Administration Tool</title>
15 <para>
16 There are many and varied opinions regarding the usefulness of SWAT.
17 No matter how hard one tries to produce the perfect configuration tool, it remains
18 an object of personal taste. SWAT is a tool that will allow Web-based configuration
19 of Samba. It has a wizard that may help to get Samba configured
20 quickly, it has context-sensitive help on each &smb.conf; parameter, it provides for monitoring of current state
21 of connection information, and it allows network-wide MS Windows network password
22 management.
23 </para>
25 <sect1>
26 <title>Features and Benefits</title>
28 <para>
29 SWAT is a facility that is part of the Samba suite. The main executable is called
30 <command>swat</command> and is invoked by the inter-networking super daemon.
31 See <link linkend="xinetd">appropriate section</link> for details.
32 </para>
34 <para>
35 SWAT uses integral samba components to locate parameters supported by the particular
36 version of Samba. Unlike tools and utilities that are external to Samba, SWAT is always
37 up to date as known Samba parameters change. SWAT provides context-sensitive help for each
38 configuration parameter, directly from <command>man</command> page entries.
39 </para>
41 <para>
42 There are network administrators who believe that it is a good idea to write systems
43 documentation inside configuration files, and for them SWAT will always be a nasty tool. SWAT
44 does not store the configuration file in any intermediate form, rather, it stores only the
45 parameter settings, so when SWAT writes the &smb.conf; file to disk, it will write only
46 those parameters that are at other than the default settings. The result is that all comments,
47 as well as parameters that are no longer supported, will be lost from the &smb.conf; file.
48 Additionally, the parameters will be written back in internal ordering.
49 </para>
51 <note><para>
52 Before using SWAT, please be warned &smbmdash; SWAT will completely replace your &smb.conf; with
53 a fully-optimized file that has been stripped of all comments you might have placed there
54 and only non-default settings will be written to the file.
55 </para></note>
57 </sect1>
59 <sect1>
60 <title>Guidelines and Technical Tips</title>
62 <para>
63 This section aims to unlock the dark secrets behind how SWAT may be made to work,
64 may be made more secure, and how to solve Internationalization support problems.
65 </para>
67 <sect2>
68 <title>Validate SWAT Installation</title>
70 <para>
71 The very first step that should be taken before attempting to configure a host
72 system for SWAT operation is to check that it is installed. This may seem a trivial
73 point to some, however several Linux distributions do not install SWAT by default,
74 even though they do ship an install-able binary support package containing SWAT
75 on the distribution media.
76 </para>
78 <para>
79 When you have confirmed that SWAT is installed it is necessary to validate
80 that the installation includes the binary <command>swat</command> file as well
81 as all the supporting text and Web files. A number of operating system distributions
82 in the past have failed to include the necessary support files, even though the
83 <command>swat</command> binary executable file was installed. 
84 </para>
86 <para>
87 Finally, when you are sure that SWAT has been fully installed, please check the SWAT
88 has been enabled in the control file for the inter-networking super-daemon (inetd or xinetd)
89 that is used on your operating system platform. 
90 </para>
92 <sect3>
93 <title>Locating the <command>swat</command> File</title>
95 <para>
96 To validate that SWAT is installed, first locate the <command>swat</command> binary
97 file on the system. It may be found under the following directories:
98 <simplelist>
99         <member><filename>/usr/local/samba/bin</filename> &smbmdash; the default Samba location.</member>
100         <member><filename>/usr/sbin</filename> &smbmdash; the default location on most Linux systems.</member>
101         <member><filename>/opt/samba/bin</filename></member>
102 </simplelist>
103 </para>
105 <para>
106 The actual location is much dependant on the choice of the operating system vendor, or as determined
107 by the administrator who compiled and installed Samba.
108 </para>
110 <para>
111 There are a number methods that may be used to locate the <command>swat</command> binary file.
112 The following methods may be helpful:
113 </para>
115 <para>
116 If <command>swat</command> is in your current operating system search path it will be easy to 
117 find it. You can ask what are the command-line options for <command>swat</command> as shown here:
118 <screen>
119 frodo:~ # swat -?
120 Usage: swat [OPTION...]
121   -a, --disable-authentication         Disable authentication (demo mode)
123 Help options:
124   -?, --help                           Show this help message
125   --usage                              Display brief usage message
127 Common samba options:
128   -d, --debuglevel=DEBUGLEVEL          Set debug level
129   -s, --configfile=CONFIGFILE          Use alternative configuration file
130   -l, --log-basename=LOGFILEBASE       Basename for log/debug files
131   -V, --version                        Print version
132 </screen>
133 </para>
135 </sect3>
137 <sect3>
138 <title>Locating the SWAT Support Files</title>
140 <para>
141 Now that you have found that <command>swat</command> is in the search path, it is easy
142 to identify where the file is located. Here is another simple way this may be done:
143 <screen>
144 frodo:~ # whereis swat
145 swat: /usr/sbin/swat /usr/share/man/man8/swat.8.gz
146 </screen>
147 </para>
149 <para>
150 If the above measures fail to locate the <command>swat</command> binary, another approach
151 is needed. The following may be used:
152 <screen>
153 frodo:/ # find / -name swat -print
154 /etc/xinetd.d/swat
155 /usr/sbin/swat
156 /usr/share/samba/swat
157 frodo:/ #
158 </screen>
159 </para>
161 <para>
162 This list shows that there is a control file for <command>xinetd</command>, the internetwork
163 super-daemon that is installed on this server. The location of the SWAT binary file is
164 <filename>/usr/sbin/swat</filename>, and the support files for it are located under the
165 directory <filename>/usr/share/samba/swat</filename>.
166 </para>
168 <para>
169 We must now check where <command>swat</command> expects to find its support files. This can
170 be done as follows:
171 <screen>
172 frodo:/ # strings /usr/sbin/swat | grep "/swat"
173 /swat/
175 /usr/share/samba/swat
176 frodo:/ #
177 </screen>
178 </para>
180 <para>
181 The <filename>/usr/share/samba/swat/</filename> entry shown in this listing is the location of the
182 support files. You should verify that the support files exist under this directory. A sample
183 list is as shown:
184 <screen>
185 jht@frodo:/> find /usr/share/samba/swat -print
186 /usr/share/samba/swat
187 /usr/share/samba/swat/help
188 /usr/share/samba/swat/lang
189 /usr/share/samba/swat/lang/ja
190 /usr/share/samba/swat/lang/ja/help
191 /usr/share/samba/swat/lang/ja/help/welcome.html
192 /usr/share/samba/swat/lang/ja/images
193 /usr/share/samba/swat/lang/ja/images/home.gif
195 /usr/share/samba/swat/lang/ja/include
196 /usr/share/samba/swat/lang/ja/include/header.nocss.html
198 /usr/share/samba/swat/lang/tr
199 /usr/share/samba/swat/lang/tr/help
200 /usr/share/samba/swat/lang/tr/help/welcome.html
201 /usr/share/samba/swat/lang/tr/images
202 /usr/share/samba/swat/lang/tr/images/home.gif
204 /usr/share/samba/swat/lang/tr/include
205 /usr/share/samba/swat/lang/tr/include/header.html
206 /usr/share/samba/swat/using_samba
208 /usr/share/samba/swat/images
209 /usr/share/samba/swat/images/home.gif
211 /usr/share/samba/swat/include
212 /usr/share/samba/swat/include/footer.html
213 /usr/share/samba/swat/include/header.html
214 jht@frodo:/>
215 </screen>
216 </para>
218 <para>
219 If the files needed are not available it will be necessary to obtain and install them
220 before SWAT can be used.
221 </para>
223 </sect3>
224 </sect2>
226 <sect2 id="xinetd">
227 <title>Enabling SWAT for Use</title>
229 <para>
230 SWAT should be installed to run via the network super-daemon. Depending on which system
231 your UNIX/Linux system has, you will have either an <command>inetd</command>- or
232 <command>xinetd</command>-based system.
233 </para>
235 <para>
236 The nature and location of the network super-daemon varies with the operating system
237 implementation. The control file (or files) can be located in the file 
238 <filename>/etc/inetd.conf</filename> or in the directory <filename>/etc/[x]inet[d].d</filename>
239 or similar.
240 </para>
242 <para>
243 The control entry for the older style file might be:
244 <indexterm><primary>swat</primary><secondary>enable</secondary></indexterm>
245 </para>
248 <para><programlisting>
249         # swat is the Samba Web Administration Tool
250         swat stream tcp nowait.400 root /usr/sbin/swat swat
251 </programlisting></para>
253 <para>
254 A control file for the newer style xinetd could be:
255 </para>
257 <para>
258         <smbfile name="xinetd.swat">
259 <programlisting>
260 # default: off
261 # description: SWAT is the Samba Web Admin Tool. Use swat \
262 #              to configure your Samba server. To use SWAT, \
263 #              connect to port 901 with your favorite web browser.
264 service swat
266         port    = 901
267         socket_type     = stream
268         wait    = no
269         only_from = localhost
270         user    = root
271         server  = /usr/sbin/swat
272         log_on_failure  += USERID
273         disable = no
275 </programlisting>
276 </smbfile>
277 In the above, the default setting for <parameter>disable</parameter> is <constant>yes</constant>.
278 This means that SWAT is disabled. To enable use of SWAT, set this parameter to <constant>no</constant>
279 as shown.
280 </para>
282 <para>
283 Both of the above examples assume that the <command>swat</command> binary has been
284 located in the <filename>/usr/sbin</filename> directory. In addition to the above,
285 SWAT will use a directory access point from which it will load its Help files
286 as well as other control information. The default location for this on most Linux
287 systems is in the directory <filename>/usr/share/samba/swat</filename>. The default
288 location using Samba defaults will be <filename>/usr/local/samba/swat</filename>.
289 </para>
291 <para>
292 Access to SWAT will prompt for a logon. If you log onto SWAT as any non-root user,
293 the only permission allowed is to view certain aspects of configuration as well as
294 access to the password change facility. The buttons that will be exposed to the non-root
295 user are: <guibutton>HOME</guibutton>, <guibutton>STATUS</guibutton>, <guibutton>VIEW</guibutton>, 
296 <guibutton>PASSWORD</guibutton>. The only page that allows
297 change capability in this case is <guibutton>PASSWORD</guibutton>.
298 </para>
300 <para>
301 As long as you log onto SWAT as the user <emphasis>root</emphasis>, you should obtain
302 full change and commit ability. The buttons that will be exposed include:
303 <guibutton>HOME</guibutton>, <guibutton>GLOBALS</guibutton>, <guibutton>SHARES</guibutton>, <guibutton>PRINTERS</guibutton>, 
304 <guibutton>WIZARD</guibutton>, <guibutton>STATUS</guibutton>, <guibutton>VIEW</guibutton>, <guibutton>PASSWORD</guibutton>.
305 </para>
307 </sect2>
309 <sect2>
310 <title>Securing SWAT through SSL</title>
313 <para>
314 <indexterm><primary>swat</primary><secondary>security</secondary></indexterm>
315 Many people have asked about how to setup SWAT with SSL to allow for secure remote
316 administration of Samba. Here is a method that works, courtesy of Markus Krieger.
317 </para>
319 <para>
320 Modifications to the SWAT setup are as follows: 
321 </para>
323 <procedure>
324         <step><para>
325         Install OpenSSL.
326         </para></step>
328         <step><para>
329         Generate certificate and private key.
331 <screen>
332 &rootprompt;<userinput>/usr/bin/openssl req -new -x509 -days 365 -nodes -config \
333         /usr/share/doc/packages/stunnel/stunnel.cnf \
334         -out /etc/stunnel/stunnel.pem -keyout /etc/stunnel/stunnel.pem</userinput>
335 </screen></para></step>
337         <step><para>
338         Remove swat-entry from [x]inetd.
339         </para></step>
341         <step><para>
342         Start <command>stunnel</command>.
344 <screen>
345 &rootprompt;<userinput>stunnel -p /etc/stunnel/stunnel.pem -d 901 \
346          -l /usr/local/samba/bin/swat swat </userinput>
347 </screen></para></step>
348 </procedure>
350 <para>
351 Afterward, simply connect to swat by using the URL <ulink noescape="1" url="https://myhost:901">https://myhost:901</ulink>, accept the certificate
352 and the SSL connection is up.
353 </para>
355 </sect2>
357 <sect2>
358 <title>Enabling SWAT Internationalization Support</title>
360 <para>
361 SWAT can be configured to display its messages to match the settings of
362 the language configurations of your Web browser. It will be passed to SWAT 
363 in the Accept-Language header of the HTTP request.
364 <para>
366 <para>
367 To enable this feature:
368 </para>
370 <itemizedlist>
371         <listitem><para>
372         Install  the proper <command>msg</command> files from the Samba
373         <filename>source/po</filename> directory into $LIBDIR.
374         </para></listitem>
376         <listitem><para>
377         Set the correct locale value for <smbconfoption><name>display charset</name></smbconfoption>.
378         </para></listitem>
380         <listitem><para>
381         Set your browsers language setting.
382         </para></listitem>
383 </itemizedlist>
385 <para>
386 The name of msg file is same as the language ID sent by the browser. For
387 example en means "English", ja means "Japanese", fr means "French.
388 </para>
390 <para>
391 If you do not like some of messages, or there are no <command>msg</command> files for
392 your locale, you can create them simply by copying the <command>en.msg</command> files
393 to the directory for <quote>your language ID.msg</quote> and filling in proper strings
394 to each <quote>msgstr</quote>. For example, in <filename>it.msg</filename>, the
395 <command>msg</command> file for the Italian locale, just set:
396 <screen>
397 msgid "Set Default"
398 msgstr "Imposta Default"
399 </screen>
400 and so on. If you find a mistake or create a new <command>msg</command> file, please email it
401 to us so we will include this in the next release of Samba.
402 </para>
404 </para>
405 Note that if you enable this feature and the <smbconfoption><name>display charset</name></smbconfoption> is not
406 matched to your browsers setting, the SWAT display may be corrupted.  In a future version of
407 Samba, SWAT will always display messages with UTF-8 encoding. You will then not need to set
408 this &smb.conf; file parameter.
409 </para>
411 </sect2>
413 </sect1>
415 <sect1>
416 <title>Overview and Quick Tour</title>
418 <para>
419 SWAT is a tools that many be used to configure Samba, or just to obtain useful links
420 to important reference materials such as the contents of this book, as well as other
421 documents that have been found useful for solving Windows networking problems.
422 </para>
424 <sect2>
425 <title>The SWAT Home Page</title>
427 <para>
428 The SWAT title page provides access to the latest Samba documentation. The manual page for
429 each Samba component is accessible from this page, as are the Samba HOWTO-Collection (this 
430 document) as well as the O'Reilly book <quote>Using Samba.</quote>
431 </para>
433 <para>
434 Administrators who wish to validate their Samba configuration may obtain useful information
435 from the man pages for the diagnostic utilities. These are available from the SWAT home page
436 also. One diagnostic tool that is not mentioned on this page, but that is particularly
437 useful is <ulink url="http://www.ethereal.com/"><command>ethereal</command>.</ulink>
438 </para>
440 <warning><para>
441 SWAT can be configured to run in <emphasis>demo</emphasis> mode. This is not recommended
442 as it runs SWAT without authentication and with full administrative ability. Allows
443 changes to &smb.conf; as well as general operation with root privileges. The option that
444 creates this ability is the <option>-a</option> flag to swat. <emphasis>Do not use this in a
445 production environment.</emphasis>
446 </para></warning>
448 </sect2>
450 <sect2>
451 <title>Global Settings</title>
453 <para>
454 The <guibutton>GLOBALS</guibutton> button will expose a page that allows configuration of the global parameters
455 in &smb.conf;. There are two levels of exposure of the parameters:
456 </para>
458 <itemizedlist>
459         <listitem><para>
460         <guibutton>Basic</guibutton> &smbmdash; exposes common configuration options.
461         </para></listitem>
463         <listitem><para>
464         <guibutton>Advanced</guibutton> &smbmdash; exposes configuration options needed in more 
465         complex environments.
466         </para></listitem>
467 </itemizedlist>
469 <para>
470 To switch to other than <guibutton>Basic</guibutton> editing ability, click on <guibutton>Advanced</guibutton>.
471 You may also do this by clicking on the radio button, then click on the <guibutton>Commit Changes</guibutton> button.
472 </para>
474 <para>
475 After making any changes to configuration parameters, make sure that
476 you click on the 
477 <guibutton>Commit Changes</guibutton> button before moving to another area, otherwise
478 your changes will be lost.
479 </para>
481 <note><para>
482 SWAT has context-sensitive help. To find out what each parameter is
483 for, simply click on the
484 <guibutton>Help</guibutton> link to the left of the configuration parameter.
485 </para></note>
487 </sect2>
489 <sect2>
490 <title>Share Settings</title>
492 <para>
493 To effect a currently configured share, simply click on the pull down button between the
494 <guibutton>Choose Share</guibutton> and the <guibutton>Delete Share</guibutton> buttons,
495 select the share you wish to operate on, then to edit the settings
496 click on the
497 <guibutton>Choose Share</guibutton> button. To delete the share, simply press the
498 <guibutton>Delete Share</guibutton> button.
499 </para>
501 <para>
502 To create a new share, next to the button labeled <guibutton>Create Share</guibutton> enter
503 into the text field the name of the share to be created, then click on the 
504 <guibutton>Create Share</guibutton> button.
505 </para>
507 </sect2>
509 <sect2>
510 <title>Printers Settings</title>
512 <para>
513 To affect a currently configured printer, simply click on the pull down button between the
514 <guibutton>Choose Printer</guibutton> and the <guibutton>Delete Printer</guibutton> buttons,
515 select the printer you wish to operate on, then to edit the settings
516 click on the
517 <guibutton>Choose Printer</guibutton> button. To delete the share, simply press the
518 <guibutton>Delete Printer</guibutton> button.
519 </para>
521 <para>
522 To create a new printer, next to the button labeled <guibutton>Create Printer</guibutton> enter
523 into the text field the name of the share to be created, then click on the 
524 <guibutton>Create Printer</guibutton> button.
525 </para>
527 </sect2>
529 <sect2>
530 <title>The SWAT Wizard</title>
532 <para>
533 The purpose if the SWAT Wizard is to help the Microsoft-knowledgeable network administrator
534 to configure Samba with a minimum of effort.
535 </para>
537 <para>
538 The Wizard page provides a tool for rewriting the &smb.conf; file in fully optimized format.
539 This will also happen if you press the <guibutton>Commit</guibutton> button. The two differ
540 since the <guibutton>Rewrite</guibutton> button ignores any changes that may have been made,
541 while the <guibutton>Commit</guibutton> button causes all changes to be affected.
542 </para>
544 <para>
545 The <guibutton>Edit</guibutton> button permits the editing (setting) of the minimal set of
546 options that may be necessary to create a working Samba server.
547 </para>
549 <para>
550 Finally, there are a limited set of options that will determine what type of server Samba
551 will be configured for, whether it will be a WINS server, participate as a WINS client, or
552 operate with no WINS support. By clicking one button, you can elect to expose (or not) user
553 home directories.
554 </para>
556 </sect2>
558 <sect2>
559 <title>The Status Page</title>
561 <para>
562 The status page serves a limited purpose. First, it allows control of the Samba daemons.
563 The key daemons that create the Samba server environment are: &smbd;, &nmbd;, &winbindd;.
564 </para>
566 <para>
567 The daemons may be controlled individually or as a total group. Additionally, you may set
568 an automatic screen refresh timing. As MS Windows clients interact with Samba, new smbd processes
569 will be continually spawned. The auto-refresh facility will allow you to track the changing
570 conditions with minimal effort.
571 </para>
573 <para>
574 Lastly, the Status page may be used to terminate specific smbd client connections in order to
575 free files that may be locked.
576 </para>
578 </sect2>
580 <sect2>
581 <title>The View Page</title>
583 <para>
584 This page allows the administrator to view the optimized &smb.conf; file and, if you are
585 particularly masochistic, will permit you also to see all possible global configuration
586 parameters and their settings.
587 </para>
589 </sect2>
591 <sect2>
592 <title>The Password Change Page</title>
594 <para>
595 The Password Change page is a popular tool that allows the creation, deletion, deactivation,
596 and reactivation of MS Windows networking users on the local machine. Alternately, you can use
597 this tool to change a local password for a user account.
598 </para>
600 <para>
601 When logged in as a non-root account, the user will have to provide the old password as well as
602 the new password (twice). When logged in as <emphasis>root</emphasis>, only the new password is
603 required.
604 </para>
606 <para>
607 One popular use for this tool is to change user passwords across a range of remote MS Windows
608 servers.
609 </para>
611 </sect2>
612 </sect1>
614 <sect1>
615 <title>SWAT View Page Displays Incorrectly</title>
617 <para>
618 When <parameter>display charset</parameter> and <parameter>dos charset</parameter> parameters
619 are different, the view page will not display correctly. Currently the 
620 <parameter>display charset</parameter> parameter must use the same encoding as that
621 in which the msg file has been encoded. In Japanese this means that <parameter>display
622 charset</parameter> must be set to <parameter>CP932</parameter>.
623 </para>
625 <para>
626 Setting <parameter>unix charset = EUCJP-MS</parameter> will cause this problem to occur.
627 </para>
629 </sect1>
631 </chapter>