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