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