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