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