819fc394452603f8ead9b341f3a575cdfff5762b
[kai/samba.git] / docs / htmldocs / smbd.8.html
1
2
3  
4
5
6 <html><head><title>smbd</title>
7
8 <link rev="made" href="mailto:samba-bugs@samba.anu.edu.au">
9 </head>
10 <body>
11
12 <hr>
13
14 <h1>smbd</h1>
15 <h2>Samba</h2>
16 <h2>23 Oct 1998</h2>
17
18     
19
20     
21 <p><br><a name="NAME"></a>
22 <h2>NAME</h2>
23     smbd - server to provide SMB/CIFS services to clients
24 <p><br><a name="SYNOPSIS"></a>
25 <h2>SYNOPSIS</h2>
26     
27 <p><br><strong>smbd</strong> [<a href="smbd.8.html#minusD">-D</a>] [<a href="smbd.8.html#minusa">-a</a>] [<a href="smbd.8.html#minuso">-o</a>] [<a href="smbd.8.html#minusd">-d debuglevel</a>] [<a href="smbd.8.html#minusl">-l log file</a>] [<a href="smbd.8.html#minusp">-p port number</a>] [<a href="smbd.8.html#minusO">-O socket options</a>] [<a href="smbd.8.html#minuss">-s configuration file</a>] [<a href="smbd.8.html#minusi">-i scope</a>] [<a href="smbd.8.html#minusP">-P</a>] [<a href="smbd.8.html#minush">-h</a>]
28 <p><br><a name="DESCRIPTION"></a>
29 <h2>DESCRIPTION</h2>
30     
31 <p><br>This program is part of the <strong>Samba</strong> suite.
32 <p><br><strong>smbd</strong> is the server daemon that provides filesharing services to
33 Windows clients. The server provides filespace and printer services to
34 clients using the SMB (or CIFS) protocol. This is compatible with the
35 LanManager protocol, and can service LanManager clients.  These
36 include MSCLIENT 3.0 for DOS, Windows for Workgroups, Windows 95,
37 Windows NT, OS/2, DAVE for Macintosh, and smbfs for Linux.
38 <p><br>An extensive description of the services that the server can provide
39 is given in the man page for the configuration file controlling the
40 attributes of those services (see <strong>smb.conf (5)</strong>).  This man page
41 will not describe the services, but will concentrate on the
42 administrative aspects of running the server.
43 <p><br>Please note that there are significant security implications to
44 running this server, and the <strong>smb.conf (5)</strong> manpage should be
45 regarded as mandatory reading before proceeding with installation.
46 <p><br>A session is created whenever a client requests one. Each client gets
47 a copy of the server for each session. This copy then services all
48 connections made by the client during that session. When all
49 connections from its client are are closed, the copy of the server for
50 that client terminates.
51 <p><br>The configuration file, and any files that it includes, are
52 automatically reloaded every minute, if they change.  You can force a
53 reload by sending a SIGHUP to the server.  Reloading the configuration
54 file will not affect connections to any service that is already
55 established.  Either the user will have to disconnect from the
56 service, or smbd killed and restarted.
57 <p><br><a name="OPTIONS"></a>
58 <h2>OPTIONS</h2>
59     
60 <p><br><ul>
61 <p><br><a name="minusD"></a>
62 <li><strong><strong>-D</strong></strong> If specified, this parameter causes the server to operate as a
63 daemon. That is, it detaches itself and runs in the background,
64 fielding requests on the appropriate port. Operating the server as a
65 daemon is the recommended way of running smbd for servers that provide
66 more than casual use file and print services.
67 <p><br>By default, the server will NOT operate as a daemon. 
68 <p><br><a name="minusa"></a>
69 <li><strong><strong>-a</strong></strong> If this parameter is specified, each new connection will
70 append log messages to the log file.  This is the default.
71 <p><br><a name="minuso"></a>
72 <li><strong><strong>-o</strong></strong> If this parameter is specified, the log files will be
73 overwritten when opened.  By default, the log files will be appended
74 to.
75 <p><br><a name="minusd"></a>
76 <li><strong><strong>-d debuglevel</strong></strong> debuglevel is an integer from 0 to 10.
77 <p><br>The default value if this parameter is not specified is zero.
78 <p><br>The higher this value, the more detail will be logged to the log files
79 about the activities of the server. At level 0, only critical errors
80 and serious warnings will be logged. Level 1 is a reasonable level for
81 day to day running - it generates a small amount of information about
82 operations carried out.
83 <p><br>Levels above 1 will generate considerable amounts of log data, and
84 should only be used when investigating a problem. Levels above 3 are
85 designed for use only by developers and generate HUGE amounts of log
86 data, most of which is extremely cryptic.
87 <p><br>Note that specifying this parameter here will override the <a href="smb.conf.5.html#loglevel"><strong>log
88 level</strong></a> parameter in the <a href="smb.conf.5.html"><strong>smb.conf
89 (5)</strong></a> file.
90 <p><br><a name="minusl"></a> 
91 <li><strong><strong>-l log file</strong></strong> If specified, <em>log file</em> specifies
92 a log filename into which informational and debug messages from the
93 running server will be logged. The log file generated is never removed
94 by the server although its size may be controlled by the <a href="smb.conf.5.html#maxlogsize"><strong>max
95 log size</strong></a> option in the <a href="smb.conf.5.html"><strong>smb.conf
96 (5)</strong></a> file.  The default log file name is specified
97 at compile time.
98 <p><br><a name="minusO"></a>
99 <li><strong><strong>-O socket options</strong></strong> See the <a href="smb.conf.5.html#socketoptions"><strong>socket
100 options</strong></a> parameter in the
101 <a href="smb.conf.5.html"><strong>smb.conf (5)</strong></a> file for details.
102 <p><br><a name="minusp"></a>
103 <li><strong><strong>-p port number</strong></strong> port number is a positive integer value.  The
104 default value if this parameter is not specified is 139.
105 <p><br>This number is the port number that will be used when making
106 connections to the server from client software. The standard
107 (well-known) port number for the SMB over TCP is 139, hence the
108 default. If you wish to run the server as an ordinary user rather than
109 as root, most systems will require you to use a port number greater
110 than 1024 - ask your system administrator for help if you are in this
111 situation.
112 <p><br>In order for the server to be useful by most clients, should you
113 configure it on a port other than 139, you will require port
114 redirection services on port 139, details of which are outlined in
115 rfc1002.txt section 4.3.5.
116 <p><br>This parameter is not normally specified except in the above
117 situation.
118 <p><br><a name="minuss"></a>
119 <li><strong><strong>-s configuration file</strong></strong> The default configuration file name is
120 determined at compile time.
121 <p><br>The file specified contains the configuration details required by the
122 server.  The information in this file includes server-specific
123 information such as what printcap file to use, as well as descriptions
124 of all the services that the server is to provide. See <strong>smb.conf
125 (5)</strong> for more information.
126 <p><br><a name="minusi"></a>
127 <li><strong><strong>-i scope</strong></strong> This specifies a NetBIOS scope that the server will use
128 to communicate with when generating NetBIOS names. For details on the
129 use of NetBIOS scopes, see rfc1001.txt and rfc1002.txt. NetBIOS scopes
130 are <em>very</em> rarely used, only set this parameter if you are the
131 system administrator in charge of all the NetBIOS systems you
132 communicate with.
133 <p><br><a name="minush"></a>
134 <li><strong><strong>-h</strong></strong> Prints the help information (usage) for smbd.
135 <p><br><a name="minusP"></a>
136 <li><strong><strong>-P</strong></strong> Passive option. Causes smbd not to send any network traffic
137 out. Used for debugging by the developers only.
138 <p><br></ul>
139 <p><br><a name="FILES"></a>
140 <h2>FILES</h2>
141     
142 <p><br><strong>/etc/inetd.conf</strong>
143 <p><br>If the server is to be run by the inetd meta-daemon, this file must
144 contain suitable startup information for the meta-daemon. See the
145 section <em>INSTALLATION</em> below.
146 <p><br><strong>/etc/rc</strong>
147 <p><br>(or whatever initialisation script your system uses).
148 <p><br>If running the server as a daemon at startup, this file will need to
149 contain an appropriate startup sequence for the server. See the
150 section <em>INSTALLATION</em> below.
151 <p><br><strong>/etc/services</strong>
152 <p><br>If running the server via the meta-daemon inetd, this file must
153 contain a mapping of service name (eg., netbios-ssn) to service port
154 (eg., 139) and protocol type (eg., tcp). See the section
155 <em>INSTALLATION</em> below.
156 <p><br><strong>/usr/local/samba/lib/smb.conf</strong>
157 <p><br>This is the default location of the <em>smb.conf</em> server configuration
158 file. Other common places that systems install this file are
159 <em>/usr/samba/lib/smb.conf</em> and <em>/etc/smb.conf</em>.
160 <p><br>This file describes all the services the server is to make available
161 to clients. See <strong>smb.conf (5)</strong> for more information.
162 <p><br><a name="LIMITATIONS"></a>
163 <h2>LIMITATIONS</h2>
164     
165 <p><br>On some systems <strong>smbd</strong> cannot change uid back to root after a
166 setuid() call.  Such systems are called "trapdoor" uid systems. If you
167 have such a system, you will be unable to connect from a client (such
168 as a PC) as two different users at once. Attempts to connect the
169 second user will result in "access denied" or similar.
170 <p><br><a name="ENVIRONMENTVARIABLES"></a>
171 <h2>ENVIRONMENT VARIABLES</h2>
172     
173 <p><br><strong>PRINTER</strong>
174 <p><br>If no printer name is specified to printable services, most systems
175 will use the value of this variable (or "lp" if this variable is not
176 defined) as the name of the printer to use. This is not specific to
177 the server, however.
178 <p><br><a name="INSTALLATION"></a>
179 <h2>INSTALLATION</h2>
180     
181 <p><br>The location of the server and its support files is a matter for
182 individual system administrators. The following are thus suggestions
183 only.
184 <p><br>It is recommended that the server software be installed under the
185 /usr/local/samba hierarchy, in a directory readable by all, writeable
186 only by root. The server program itself should be executable by all,
187 as users may wish to run the server themselves (in which case it will
188 of course run with their privileges).  The server should NOT be
189 setuid. On some systems it may be worthwhile to make smbd setgid to an
190 empty group. This is because some systems may have a security hole
191 where daemon processes that become a user can be attached to with a
192 debugger. Making the smbd file setgid to an empty group may prevent
193 this hole from being exploited. This security hole and the suggested
194 fix has only been confirmed on old versions (pre-kernel 2.0) of Linux
195 at the time this was written. It is possible that this hole only
196 exists in Linux, as testing on other systems has thus far shown them
197 to be immune.
198 <p><br>The server log files should be put in a directory readable and
199 writable only by root, as the log files may contain sensitive
200 information.
201 <p><br>The configuration file should be placed in a directory readable and
202 writable only by root, as the configuration file controls security for
203 the services offered by the server. The configuration file can be made
204 readable by all if desired, but this is not necessary for correct
205 operation of the server and is not recommended. A sample configuration
206 file "smb.conf.sample" is supplied with the source to the server -
207 this may be renamed to "smb.conf" and modified to suit your needs.
208 <p><br>The remaining notes will assume the following:
209 <p><br><ul>
210 <p><br><li > <strong>smbd</strong> (the server program) installed in /usr/local/samba/bin
211 <p><br><li > <strong>smb.conf</strong> (the configuration file) installed in /usr/local/samba/lib
212 <p><br><li > log files stored in /var/adm/smblogs
213 <p><br></ul>
214 <p><br>The server may be run either as a daemon by users or at startup, or it
215 may be run from a meta-daemon such as inetd upon request. If run as a
216 daemon, the server will always be ready, so starting sessions will be
217 faster. If run from a meta-daemon some memory will be saved and
218 utilities such as the tcpd TCP-wrapper may be used for extra security.
219 For serious use as file server it is recommended that <strong>smbd</strong> be run
220 as a daemon.
221 <p><br>When you've decided, continue with either <em>RUNNING THE SERVER AS A
222 DAEMON</em> or <em>RUNNING THE SERVER ON REQUEST</em>.
223 <p><br><a name="RUNNINGTHESERVERASADAEMON"></a>
224 <h2>RUNNING THE SERVER AS A DAEMON</h2>
225     
226 <p><br>To run the server as a daemon from the command line, simply put the
227 <a href="smbd.8.html#minusD"><strong>-D</strong></a> option on the command line. There is no need to place an
228 ampersand at the end of the command line - the <a href="smbd.8.html#minusD"><strong>-D</strong></a> option causes
229 the server to detach itself from the tty anyway.
230 <p><br>Any user can run the server as a daemon (execute permissions
231 permitting, of course). This is useful for testing purposes, and may
232 even be useful as a temporary substitute for something like ftp. When
233 run this way, however, the server will only have the privileges of the
234 user who ran it.
235 <p><br>To ensure that the server is run as a daemon whenever the machine is
236 started, and to ensure that it runs as root so that it can serve
237 multiple clients, you will need to modify the system startup
238 files. Wherever appropriate (for example, in /etc/rc), insert the
239 following line, substituting port number, log file location,
240 configuration file location and debug level as desired:
241 <p><br><code>/usr/local/samba/bin/smbd -D -l /var/adm/smblogs/log -s /usr/local/samba/lib/smb.conf</code>
242 <p><br>(The above should appear in your initialisation script as a single line. 
243 Depending on your terminal characteristics, it may not appear that way in
244 this man page. If the above appears as more than one line, please treat any 
245 newlines or indentation as a single space or TAB character.)
246 <p><br>If the options used at compile time are appropriate for your system,
247 all parameters except the desired debug level and <a href="smbd.8.html#minusD"><strong>-D</strong></a> may be
248 omitted. See the section <em>OPTIONS</em> above.
249 <p><br><a name="RUNNINGTHESERVERONREQUEST"></a>
250 <h2>RUNNING THE SERVER ON REQUEST</h2>
251     
252 <p><br>If your system uses a meta-daemon such as inetd, you can arrange to
253 have the smbd server started whenever a process attempts to connect to
254 it. This requires several changes to the startup files on the host
255 machine. If you are experimenting as an ordinary user rather than as
256 root, you will need the assistance of your system administrator to
257 modify the system files.
258 <p><br>You will probably want to set up the NetBIOS name server <a href="nmbd.8.html"><strong>nmbd</strong></a> at
259 the same time as <strong>smbd</strong>. To do this refer to the man page for
260 <a href="nmbd.8.html"><strong>nmbd (8)</strong></a>.
261 <p><br>First, ensure that a port is configured in the file /etc/services. The
262 well-known port 139 should be used if possible, though any port may be
263 used.
264 <p><br>Ensure that a line similar to the following is in /etc/services:
265 <p><br><code>netbios-ssn        139/tcp</code>
266 <p><br>Note for NIS/YP users - you may need to rebuild the NIS service maps
267 rather than alter your local /etc/services file.
268 <p><br>Next, put a suitable line in the file /etc/inetd.conf (in the unlikely
269 event that you are using a meta-daemon other than inetd, you are on
270 your own). Note that the first item in this line matches the service
271 name in /etc/services.  Substitute appropriate values for your system
272 in this line (see <strong>inetd (8)</strong>):
273 <p><br><code>netbios-ssn stream tcp nowait root /usr/local/samba/bin/smbd -d1 -l/var/adm/smblogs/log -s/usr/local/samba/lib/smb.conf</code>
274 <p><br>(The above should appear in /etc/inetd.conf as a single
275 line. Depending on your terminal characteristics, it may not appear
276 that way in this man page.  If the above appears as more than one
277 line, please treat any newlines or indentation as a single space or
278 TAB character.)
279 <p><br>Note that there is no need to specify a port number here, even if you
280 are using a non-standard port number.
281 <p><br>Lastly, edit the configuration file to provide suitable services. To
282 start with, the following two services should be all you need:
283 <p><br><pre>
284
285
286 [homes]
287   writable = yes
288
289 [printers]
290  writable = no
291  printable = yes
292  path = /tmp
293  public = yes
294
295
296 </pre>
297
298 <p><br>This will allow you to connect to your home directory and print to any
299 printer supported by the host (user privileges permitting).
300 <p><br><a name="TESTINGTHEINSTALLATION"></a>
301 <h2>TESTING THE INSTALLATION</h2>
302     
303 <p><br>If running the server as a daemon, execute it before proceeding. If
304 using a meta-daemon, either restart the system or kill and restart the
305 meta-daemon. Some versions of inetd will reread their configuration
306 tables if they receive a HUP signal.
307 <p><br>If your machine's name is "fred" and your name is "mary", you should
308 now be able to connect to the service <code>\\fred\mary</code>.
309 <p><br>To properly test and experiment with the server, we recommend using
310 the smbclient program (see <strong>smbclient (1)</strong>) and also going through
311 the steps outlined in the file <em>DIAGNOSIS.txt</em> in the <em>docs/</em>
312 directory of your Samba installation.
313 <p><br><a name="VERSION"></a>
314 <h2>VERSION</h2>
315     
316 <p><br>This man page is correct for version 2.0 of the Samba suite.
317 <p><br><a name="DIAGNOSTICS"></a>
318 <h2>DIAGNOSTICS</h2>
319     
320 <p><br>Most diagnostics issued by the server are logged in a specified log
321 file. The log file name is specified at compile time, but may be
322 overridden on the command line.
323 <p><br>The number and nature of diagnostics available depends on the debug
324 level used by the server. If you have problems, set the debug level to
325 3 and peruse the log files.
326 <p><br>Most messages are reasonably self-explanatory. Unfortunately, at time
327 of creation of this man page there are too many diagnostics available
328 in the source code to warrant describing each and every diagnostic. At
329 this stage your best bet is still to grep the source code and inspect
330 the conditions that gave rise to the diagnostics you are seeing.
331 <p><br><a name="SIGNALS"></a>
332 <h2>SIGNALS</h2>
333     
334 <p><br>Sending the smbd a SIGHUP will cause it to re-load its smb.conf
335 configuration file within a short period of time.
336 <p><br>To shut down a users smbd process it is recommended that SIGKILL (-9)
337 <em>NOT</em> be used, except as a last resort, as this may leave the shared
338 memory area in an inconsistant state. The safe way to terminate an
339 smbd is to send it a SIGTERM (-15) signal and wait for it to die on
340 its own.
341 <p><br>The debug log level of smbd may be raised
342 by sending it a SIGUSR1 <code>(kill -USR1 &lt;smbd-pid&gt;)</code> and lowered by
343 sending it a SIGUSR2 <code>(kill -USR2 &lt;smbd-pid&gt;)</code>. This is to allow
344 transient problems to be diagnosed, whilst still running at a normally
345 low log level.
346 <p><br>Note that as the signal handlers send a debug write, they are not
347 re-entrant in smbd. This you should wait until smbd is in a state of
348 waiting for an incoming smb before issuing them. It is possible to
349 make the signal handlers safe by un-blocking the signals before the
350 select call and re-blocking them after, however this would affect
351 performance.
352 <p><br><a name="SEEALSO"></a>
353 <h2>SEE ALSO</h2>
354     
355 <p><br><strong>hosts_access (5)</strong>, <strong>inetd (8)</strong>, <a href="nmbd.8.html"><strong>nmbd (8)</strong></a>,
356 <a href="smb.conf.5.html"><strong>smb.conf (5)</strong></a>, <a href="smbclient.1.html"><strong>smbclient
357 (1)</strong></a>, <a href="testparm.1.html"><strong>testparm (1)</strong></a>,
358 <a href="testprns.1.html"><strong>testprns (1)</strong></a>, and the Internet RFC's
359 <strong>rfc1001.txt</strong>, <strong>rfc1002.txt</strong>. In addition the CIFS (formerly SMB)
360 specification is available as a link from the Web page :
361 <a href="http://samba.anu.edu.au/cifs/">http://samba.anu.edu.au/cifs/</a>.
362 <p><br><a name="AUTHOR"></a>
363 <h2>AUTHOR</h2>
364     
365 <p><br>The original Samba software and related utilities were created by
366 Andrew Tridgell (samba-bugs@samba.anu.edu.au). Samba is now developed
367 by the Samba Team as an Open Source project similar to the way the
368 Linux kernel is developed.
369 <p><br>The original Samba man pages were written by Karl Auer. The man page
370 sources were converted to YODL format (another excellent piece of Open
371 Source software) and updated for the Samba2.0 release by Jeremy
372 Allison, <a href="mailto:samba-bugs@samba.anu.edu.au"><em>samba-bugs@samba.anu.edu.au</em></a>.
373 <p><br>See <a href="samba.7.html"><strong>samba (7)</strong></a> to find out how to get a full list of contributors
374 and details on how to submit bug reports, comments etc.
375 </body>
376 </html>