Get rid of unused elements, simply image handling
[Samba/bb.git] / docs / Samba3-HOWTO / TOSHARG-SWAT.xml
blob1995778d335ab272b7afd60911e6d4bf6296600b
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">
3 <chapter id="SWAT">
4 <chapterinfo>
5         &author.jht;
6         <pubdate>April 21, 2003</pubdate>
7 </chapterinfo>
9 <title>SWAT &smbmdash; The Samba Web Administration Tool</title>
11 <para>
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
18 management.
19 </para>
21 <sect1>
22 <title>Features and Benefits</title>
24 <para>
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.
28 </para>
30 <para>
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.
35 </para>
37 <para>
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.
45 </para>
47 <note><para>
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.
51 </para></note>
53 </sect1>
55 <sect1>
56 <title>Guidelines and Technical Tips</title>
58 <para>
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.
61 </para>
63 <sect2>
64 <title>Validate SWAT Installation</title>
66 <para>
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.
72 </para>
74 <para>
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. 
80 </para>
82 <para>
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. 
86 </para>
88 <sect3>
89 <title>Locating the <command>swat</command> File</title>
91 <para>
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:
94 <simplelist>
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>
98 </simplelist>
99 </para>
101 <para>
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.
104 </para>
106 <para>
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:
109 </para>
111 <para>
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:
114 <screen>
115 frodo:~ # swat -?
116 Usage: swat [OPTION...]
117   -a, --disable-authentication         Disable authentication (demo mode)
119 Help options:
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
128 </screen>
129 </para>
131 </sect3>
133 <sect3>
134 <title>Locating the SWAT Support Files</title>
136 <para>
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:
139 <screen>
140 frodo:~ # whereis swat
141 swat: /usr/sbin/swat /usr/share/man/man8/swat.8.gz
142 </screen>
143 </para>
145 <para>
146 If the above measures fail to locate the <command>swat</command> binary, another approach
147 is needed. The following may be used:
148 <screen>
149 frodo:/ # find / -name swat -print
150 /etc/xinetd.d/swat
151 /usr/sbin/swat
152 /usr/share/samba/swat
153 frodo:/ #
154 </screen>
155 </para>
157 <para>
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>.
162 </para>
164 <para>
165 We must now check where <command>swat</command> expects to find its support files. This can
166 be done as follows:
167 <screen>
168 frodo:/ # strings /usr/sbin/swat | grep "/swat"
169 /swat/
171 /usr/share/samba/swat
172 frodo:/ #
173 </screen>
174 </para>
176 <para>
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
179 list is as shown:
180 <screen>
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
210 jht@frodo:/>
211 </screen>
212 </para>
214 <para>
215 If the files needed are not available it will be necessary to obtain and install them
216 before SWAT can be used.
217 </para>
219 </sect3>
220 </sect2>
222 <sect2 id="xinetd">
223 <title>Enabling SWAT for Use</title>
225 <para>
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.
229 </para>
231 <para>
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>
235 or similar.
236 </para>
238 <para>
239 The control entry for the older style file might be:
240 <indexterm><primary>swat</primary><secondary>enable</secondary></indexterm>
241 </para>
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>
249 <para>
250 A control file for the newer style xinetd could be:
251 </para>
253 <para>
254 <programlisting>
255 # default: off
256 # description: SWAT is the Samba Web Admin Tool. Use swat \
257 #              to configure your Samba server. To use SWAT, \
258 #              connect to port 901 with your favorite web browser.
259 service swat
261         port    = 901
262         socket_type     = stream
263         wait    = no
264         only_from = localhost
265         user    = root
266         server  = /usr/sbin/swat
267         log_on_failure  += USERID
268         disable = no
270 </programlisting>
271 In the above, the default setting for <parameter>disable</parameter> is <constant>yes</constant>.
272 This means that SWAT is disabled. To enable use of SWAT, set this parameter to <constant>no</constant>
273 as shown.
274 </para>
276 <para>
277 Both of the above examples assume that the <command>swat</command> binary has been
278 located in the <filename>/usr/sbin</filename> directory. In addition to the above,
279 SWAT will use a directory access point from which it will load its Help files
280 as well as other control information. The default location for this on most Linux
281 systems is in the directory <filename>/usr/share/samba/swat</filename>. The default
282 location using Samba defaults will be <filename>/usr/local/samba/swat</filename>.
283 </para>
285 <para>
286 Access to SWAT will prompt for a logon. If you log onto SWAT as any non-root user,
287 the only permission allowed is to view certain aspects of configuration as well as
288 access to the password change facility. The buttons that will be exposed to the non-root
289 user are: <guibutton>HOME</guibutton>, <guibutton>STATUS</guibutton>, <guibutton>VIEW</guibutton>, 
290 <guibutton>PASSWORD</guibutton>. The only page that allows
291 change capability in this case is <guibutton>PASSWORD</guibutton>.
292 </para>
294 <para>
295 As long as you log onto SWAT as the user <emphasis>root</emphasis>, you should obtain
296 full change and commit ability. The buttons that will be exposed include:
297 <guibutton>HOME</guibutton>, <guibutton>GLOBALS</guibutton>, <guibutton>SHARES</guibutton>, <guibutton>PRINTERS</guibutton>, 
298 <guibutton>WIZARD</guibutton>, <guibutton>STATUS</guibutton>, <guibutton>VIEW</guibutton>, <guibutton>PASSWORD</guibutton>.
299 </para>
301 </sect2>
303 <sect2>
304 <title>Securing SWAT through SSL</title>
307 <para>
308 <indexterm><primary>swat</primary><secondary>security</secondary></indexterm>
309 Many people have asked about how to setup SWAT with SSL to allow for secure remote
310 administration of Samba. Here is a method that works, courtesy of Markus Krieger.
311 </para>
313 <para>
314 Modifications to the SWAT setup are as follows: 
315 </para>
317 <procedure>
318         <step><para>
319         Install OpenSSL.
320         </para></step>
322         <step><para>
323         Generate certificate and private key.
325 <screen>
326 &rootprompt;<userinput>/usr/bin/openssl req -new -x509 -days 365 -nodes -config \
327         /usr/share/doc/packages/stunnel/stunnel.cnf \
328         -out /etc/stunnel/stunnel.pem -keyout /etc/stunnel/stunnel.pem</userinput>
329 </screen></para></step>
331         <step><para>
332         Remove swat-entry from [x]inetd.
333         </para></step>
335         <step><para>
336         Start <command>stunnel</command>.
338 <screen>
339 &rootprompt;<userinput>stunnel -p /etc/stunnel/stunnel.pem -d 901 \
340          -l /usr/local/samba/bin/swat swat </userinput>
341 </screen></para></step>
342 </procedure>
344 <para>
345 Afterward, simply connect to swat by using the URL <ulink noescape="1" url="https://myhost:901">https://myhost:901</ulink>, accept the certificate
346 and the SSL connection is up.
347 </para>
349 </sect2>
351 <sect2>
352 <title>Enabling SWAT Internationalization Support</title>
354 <para>
355 SWAT can be configured to display its messages to match the settings of
356 the language configurations of your Web browser. It will be passed to SWAT 
357 in the Accept-Language header of the HTTP request.
358 </para>
360 <para>
361 To enable this feature:
362 </para>
364 <itemizedlist>
365         <listitem><para>
366         Install  the proper <command>msg</command> files from the Samba
367         <filename>source/po</filename> directory into $LIBDIR.
368         </para></listitem>
370         <listitem><para>
371         Set your browsers language setting.
372         </para></listitem>
373 </itemizedlist>
375 <para>
376 The name of msg file is same as the language ID sent by the browser. For
377 example en means "English", ja means "Japanese", fr means "French.
378 </para>
380 <para>
381 If you do not like some of messages, or there are no <command>msg</command> files for
382 your locale, you can create them simply by copying the <command>en.msg</command> files
383 to the directory for <quote>your language ID.msg</quote> and filling in proper strings
384 to each <quote>msgstr</quote>. For example, in <filename>it.msg</filename>, the
385 <command>msg</command> file for the Italian locale, just set:
386 <screen>
387 msgid "Set Default"
388 msgstr "Imposta Default"
389 </screen>
390 and so on. If you find a mistake or create a new <command>msg</command> file, please email it
391 to us so we will include this in the next release of Samba. The <command>msg</command> file should be encoded in UTF-8.
392 </para>
394 <para>
395 Note that if you enable this feature and the <smbconfoption name="display charset"/> is not
396 matched to your browsers setting, the SWAT display may be corrupted.  In a future version of
397 Samba, SWAT will always display messages with UTF-8 encoding. You will then not need to set
398 this &smb.conf; file parameter.
399 </para>
401 </sect2>
403 </sect1>
405 <sect1>
406 <title>Overview and Quick Tour</title>
408 <para>
409 SWAT is a tools that many be used to configure Samba, or just to obtain useful links
410 to important reference materials such as the contents of this book, as well as other
411 documents that have been found useful for solving Windows networking problems.
412 </para>
414 <sect2>
415 <title>The SWAT Home Page</title>
417 <para>
418 The SWAT title page provides access to the latest Samba documentation. The manual page for
419 each Samba component is accessible from this page, as are the Samba HOWTO-Collection (this 
420 document) as well as the O'Reilly book <quote>Using Samba.</quote>
421 </para>
423 <para>
424 Administrators who wish to validate their Samba configuration may obtain useful information
425 from the man pages for the diagnostic utilities. These are available from the SWAT home page
426 also. One diagnostic tool that is not mentioned on this page, but that is particularly
427 useful is <ulink url="http://www.ethereal.com/"><command>ethereal</command>.</ulink>
428 </para>
430 <warning><para>
431 SWAT can be configured to run in <emphasis>demo</emphasis> mode. This is not recommended
432 as it runs SWAT without authentication and with full administrative ability. Allows
433 changes to &smb.conf; as well as general operation with root privileges. The option that
434 creates this ability is the <option>-a</option> flag to swat. <emphasis>Do not use this in a
435 production environment.</emphasis>
436 </para></warning>
438 </sect2>
440 <sect2>
441 <title>Global Settings</title>
443 <para>
444 The <guibutton>GLOBALS</guibutton> button will expose a page that allows configuration of the global parameters
445 in &smb.conf;. There are two levels of exposure of the parameters:
446 </para>
448 <itemizedlist>
449         <listitem><para>
450         <guibutton>Basic</guibutton> &smbmdash; exposes common configuration options.
451         </para></listitem>
453         <listitem><para>
454         <guibutton>Advanced</guibutton> &smbmdash; exposes configuration options needed in more 
455         complex environments.
456         </para></listitem>
457 </itemizedlist>
459 <para>
460 To switch to other than <guibutton>Basic</guibutton> editing ability, click on <guibutton>Advanced</guibutton>.
461 You may also do this by clicking on the radio button, then click on the <guibutton>Commit Changes</guibutton> button.
462 </para>
464 <para>
465 After making any changes to configuration parameters, make sure that
466 you click on the 
467 <guibutton>Commit Changes</guibutton> button before moving to another area, otherwise
468 your changes will be lost.
469 </para>
471 <note><para>
472 SWAT has context-sensitive help. To find out what each parameter is
473 for, simply click on the
474 <guibutton>Help</guibutton> link to the left of the configuration parameter.
475 </para></note>
477 </sect2>
479 <sect2>
480 <title>Share Settings</title>
482 <para>
483 To effect a currently configured share, simply click on the pull down button between the
484 <guibutton>Choose Share</guibutton> and the <guibutton>Delete Share</guibutton> buttons,
485 select the share you wish to operate on, then to edit the settings
486 click on the
487 <guibutton>Choose Share</guibutton> button. To delete the share, simply press the
488 <guibutton>Delete Share</guibutton> button.
489 </para>
491 <para>
492 To create a new share, next to the button labeled <guibutton>Create Share</guibutton> enter
493 into the text field the name of the share to be created, then click on the 
494 <guibutton>Create Share</guibutton> button.
495 </para>
497 </sect2>
499 <sect2>
500 <title>Printers Settings</title>
502 <para>
503 To affect a currently configured printer, simply click on the pull down button between the
504 <guibutton>Choose Printer</guibutton> and the <guibutton>Delete Printer</guibutton> buttons,
505 select the printer you wish to operate on, then to edit the settings
506 click on the
507 <guibutton>Choose Printer</guibutton> button. To delete the share, simply press the
508 <guibutton>Delete Printer</guibutton> button.
509 </para>
511 <para>
512 To create a new printer, next to the button labeled <guibutton>Create Printer</guibutton> enter
513 into the text field the name of the share to be created, then click on the 
514 <guibutton>Create Printer</guibutton> button.
515 </para>
517 </sect2>
519 <sect2>
520 <title>The SWAT Wizard</title>
522 <para>
523 The purpose if the SWAT Wizard is to help the Microsoft-knowledgeable network administrator
524 to configure Samba with a minimum of effort.
525 </para>
527 <para>
528 The Wizard page provides a tool for rewriting the &smb.conf; file in fully optimized format.
529 This will also happen if you press the <guibutton>Commit</guibutton> button. The two differ
530 since the <guibutton>Rewrite</guibutton> button ignores any changes that may have been made,
531 while the <guibutton>Commit</guibutton> button causes all changes to be affected.
532 </para>
534 <para>
535 The <guibutton>Edit</guibutton> button permits the editing (setting) of the minimal set of
536 options that may be necessary to create a working Samba server.
537 </para>
539 <para>
540 Finally, there are a limited set of options that will determine what type of server Samba
541 will be configured for, whether it will be a WINS server, participate as a WINS client, or
542 operate with no WINS support. By clicking one button, you can elect to expose (or not) user
543 home directories.
544 </para>
546 </sect2>
548 <sect2>
549 <title>The Status Page</title>
551 <para>
552 The status page serves a limited purpose. First, it allows control of the Samba daemons.
553 The key daemons that create the Samba server environment are: &smbd;, &nmbd;, &winbindd;.
554 </para>
556 <para>
557 The daemons may be controlled individually or as a total group. Additionally, you may set
558 an automatic screen refresh timing. As MS Windows clients interact with Samba, new smbd processes
559 will be continually spawned. The auto-refresh facility will allow you to track the changing
560 conditions with minimal effort.
561 </para>
563 <para>
564 Lastly, the Status page may be used to terminate specific smbd client connections in order to
565 free files that may be locked.
566 </para>
568 </sect2>
570 <sect2>
571 <title>The View Page</title>
573 <para>
574 This page allows the administrator to view the optimized &smb.conf; file and, if you are
575 particularly masochistic, will permit you also to see all possible global configuration
576 parameters and their settings.
577 </para>
579 </sect2>
581 <sect2>
582 <title>The Password Change Page</title>
584 <para>
585 The Password Change page is a popular tool that allows the creation, deletion, deactivation,
586 and reactivation of MS Windows networking users on the local machine. Alternately, you can use
587 this tool to change a local password for a user account.
588 </para>
590 <para>
591 When logged in as a non-root account, the user will have to provide the old password as well as
592 the new password (twice). When logged in as <emphasis>root</emphasis>, only the new password is
593 required.
594 </para>
596 <para>
597 One popular use for this tool is to change user passwords across a range of remote MS Windows
598 servers.
599 </para>
601 </sect2>
602 </sect1>
604 </chapter>