trying to get HEAD building again. If you want the code
[tprouty/samba.git] / docs / docbook / projdoc / SWAT.xml
1 <chapter id="SWAT">
2 <chapterinfo>
3         &author.jht;
4         <pubdate>April 21, 2003</pubdate>
5 </chapterinfo>
6
7 <title>SWAT - The Samba Web Administration Tool</title>
8
9 <para>
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
16 management.
17 </para>
18
19 <sect1>
20 <title>Features and Benefits</title>
21
22 <para>
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
29 internal ordering.
30 </para>
31
32 <note><para>
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.
36 </para></note>
37
38 <sect2>
39 <title>Enabling SWAT for use</title>
40
41 <para>
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.
45 </para>
46
47 <para>
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>
51 or similar.
52 </para>
53
54 <para>
55 The control entry for the older style file might be:
56 </para>
57
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>
62
63 <para>
64 A control file for the newer style xinetd could be:
65 </para>
66
67 <para>
68 <programlisting>
69         # default: off
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.
73         service swat
74         {
75                 port    = 901
76                 socket_type     = stream
77                 wait    = no
78                 only_from = localhost
79                 user    = root
80                 server  = /usr/sbin/swat
81                 log_on_failure  += USERID
82                 disable = yes
83         }
84 </programlisting>
85
86 </para>
87
88 <para>
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>.
95 </para>
96
97 <para>
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>.
104 </para>
105
106 <para>
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>.
111 </para>
112
113 </sect2>
114
115 <sect2>
116 <title>Securing SWAT through SSL</title>
117
118 <para>
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
121 </para>
122
123 <para>
124 Modifications to the swat setup are as following: 
125 </para>
126
127 <procedure>
128         <step><para>
129         install OpenSSL 
130         </para></step>
131
132         <step><para>
133         generate certificate and private key
134
135         <screen>
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>
140
141         <step><para>
142         remove swat-entry from [x]inetd 
143         </para></step>
144
145         <step><para>
146         start stunnel
147
148         <screen>
149 &rootprompt;<userinput>stunnel -p /etc/stunnel/stunnel.pem -d 901 \
150          -l /usr/local/samba/bin/swat swat </userinput>
151         </screen></para></step>
152 </procedure>
153
154 <para>
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.
157 </para>
158
159 </sect2>
160
161 <sect2>
162 <title>The SWAT Home Page</title>
163
164 <para>
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".
168 </para>
169
170 <para>
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>.
176 </para>
177
178 <warning><para>
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>
184 </para></warning>
185
186 </sect2>
187
188 <sect2>
189 <title>Global Settings</title>
190
191 <para>
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:
194 </para>
195
196 <itemizedlist>
197         <listitem><para>
198         <emphasis>Basic</emphasis> - exposes common configuration options.
199         </para></listitem>
200
201         <listitem><para>
202         <emphasis>Advanced</emphasis> - exposes  configuration options needed in more 
203         complex environments.
204         </para></listitem>
205
206         <listitem><para>
207         <emphasis>Developer</emphasis> - exposes configuration options that only the brave
208         will want to tamper with.
209         </para></listitem>
210 </itemizedlist>
211
212 <para>
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.
216 </para>
217
218 <para>
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.
222 </para>
223
224 <note><para>
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.
227 </para></note>
228
229 </sect2>
230
231 <sect2>
232 <title>Share Settings</title>
233
234 <para>
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.
240 </para>
241
242 <para>
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.
246 </para>
247
248 </sect2>
249
250 <sect2>
251 <title>Printers Settings</title>
252
253 <para>
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.
259 </para>
260
261 <para>
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.
265 </para>
266
267 </sect2>
268
269 <sect2>
270 <title>The SWAT Wizard</title>
271
272 <para>
273 The purpose if the SWAT Wizard is to help the Microsoft knowledgeable network administrator
274 to configure Samba with a minimum of effort.
275 </para>
276
277 <para>
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
281 affected.
282 </para>
283
284 <para>
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.
287 </para>
288
289 <para>
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
293 home directories.
294 </para>
295
296 </sect2>
297
298 <sect2>
299 <title>The Status Page</title>
300
301 <para>
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;.
304 </para>
305
306 <para>
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.
311 </para>
312
313 <para>
314 Lastly, the Status page may be used to terminate specific smbd client connections in order to
315 free files that may be locked.
316 </para>
317
318 </sect2>
319
320 <sect2>
321 <title>The View Page</title>
322
323 <para>
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.
327 </para>
328
329 </sect2>
330
331 <sect2>
332 <title>The Password Change Page</title>
333
334 <para>
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.
338 </para>
339
340 <para>
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
343 required.
344 </para>
345
346 <para>
347 One popular use for this tool is to change user passwords across a range of remote MS Windows
348 servers.
349 </para>
350
351 </sect2>
352 </sect1>
353 </chapter>