SMBD(8)

โœจ smbd(8) โœจ โ€” the server daemon that serves up SMB/CIFS to clients ๐Ÿ’…

okay so bestie, you found the big one. this is smbd, and it is the main character of the Samba show. let's get into it ๐Ÿซถ


๐ŸŽ€ NAME ๐ŸŽ€

smbd โ€” server to provide SMB/CIFS services to clients


๐ŸŒธ SYNOPSIS ๐ŸŒธ

smbd [-D|--daemon] [-i|--interactive] [-F|--foreground]
 [--no-process-group] [-b|--build-options] [-p <port number(s)>]
 [-P <profiling level>] [-d <debug level>] [--debug-stdout]
 [--configfile=<configuration file>] [--option=<name>=<value>]
 [-l|--log-basename <log directory>] [--leak-report]
 [--leak-report-full] [-V|--version]

๐Ÿ’– DESCRIPTION ๐Ÿ’–

so this program is part of the samba(7) suite. iconic family, no notes.

smbd is the server daemon that provides filesharing and printing services to Windows clients. it hands out filespace and printer services to clients using the SMB (or CIFS) protocol. and the way it's literally compatible with the LanManager protocol and can service LanManager clients? obsessed. the client list includes MSCLIENT 3.0 for DOS, Windows for Workgroups, Windows 95/98/ME, Windows NT, Windows 2000, OS/2, DAVE for Macintosh, and smbfs for Linux. a whole roster fr fr.

if you want the extensive description of all the services the server can provide, that lives in the man page for the configuration file that controls the attributes of those services โ€” go read smb.conf(5). this man page is NOT here to describe the services, it's here for the administrative side of running the server. different vibe, different job ๐Ÿ’…

bestie, real talk: there are significant security implications to running this server. the smb.conf(5) manual page should be regarded as mandatory reading before you proceed with installation. not optional. not skimmable. mandatory. ๐Ÿ™ˆ

A session is created whenever a client requests one. Each client gets a copy of the server for each session. This copy then services all connections made by the client during that session. When all connections from its client are closed, the copy of the server for that client terminates. (yes, a lil copy per client, it's giving personal assistant energy โœจ)

The configuration file, and any files that it includes, are automatically reloaded every three minutes, if they change. One can force a reload by sending a SIGHUP to the server. Reloading the configuration file will not affect connections to any service that is already established. Either the user will have to disconnect from the service, or smbd killed and restarted. no shortcuts there, sorry ๐Ÿซ 

Instead of sending a SIGHUP signal, a request to reload configuration file may be sent using smbcontrol(1). cuuute, love options.


โœจ OPTIONS โœจ

  • -D|--daemon โ€” if you specify this, the server operates as a daemon. that means it detaches itself and runs in the background, fielding requests on the appropriate port. running the server as a daemon is the recommended way to run smbd on servers that provide more than casual-use file and print services. and heads up: this switch is assumed if smbd is executed on the command line of a shell. it just does it. periodt.
  • -i|--interactive โ€” this one makes the server run "interactively", not as a daemon, even if the server is executed on the command line of a shell. setting this parameter negates the implicit daemon mode you'd get when run from the command line. smbd will only accept one connection and terminate. it will also log to standard output, as if the -S parameter had been given. one and done, babe ๐Ÿ’…
  • -F|--foreground โ€” if specified, the main smbd process will not daemonize, i.e. it won't double-fork and disassociate with the terminal. child processes are still created as normal to service each connection request, but the main process does not exit. this mode is suitable for running smbd under process supervisors such as supervise and svscan from Daniel J. Bernstein's daemontools package, or the AIX process monitor. main character stays on screen, the kids do the work ๐Ÿงš
  • --no-process-group โ€” do not create a new process group for smbd.
  • -b|--build-options โ€” prints information about how Samba was built. receipts, basically ๐Ÿ“
  • -p|--port<port number(s)> โ€” port number(s) is a space or comma-separated list of TCP ports smbd should listen on. the default value is taken from the ports parameter in /etc/samba/smb.conf.

the default ports are 139 (used for SMB over NetBIOS over TCP) and port 445 (used for plain SMB over TCP).

  • -P|--profiling-level<profiling level> โ€” profiling level is a number specifying the level of profiling data to be collected. 0 turns off profiling, 1 turns on counter profiling only, 2 turns on complete profiling, and 3 resets all profiling data.
  • -d|--debuglevel=level โ€” level is an integer from 0 to 10. the default value if this parameter is not specified is 0.

the higher this value, the more detail will be logged to the log files about the activities of the server. at level 0, only critical errors and serious warnings will be logged. level 1 is a reasonable level for day-to-day running โ€” it generates a small amount of information about operations carried out.

levels above 1 will generate considerable amounts of log data, and should only be used when investigating a problem. levels above 3 are designed for use only by developers and generate HUGE amounts of log data, most of which is extremely cryptic. like, wall-of-text cryptic. ๐Ÿ’€

note that specifying this parameter here will override the log level parameter in the /etc/samba/smb.conf file.

  • --debug-stdout โ€” this will redirect debug output to STDOUT. by default server daemons are logging to a log file. now the debug is just... right there. on your screen. hi ๐Ÿ‘‹
  • --configfile=CONFIGFILE โ€” the file specified contains the configuration details required by the server. the information in this file includes server-specific info such as what printcap file to use, plus descriptions of all the services the server is to provide. see /etc/samba/smb.conf for more information. the default configuration file name is determined at compile time. so it is what it is, check your build ๐ŸŽ€
  • --option=<name>=<value> โ€” set the smb.conf(5) option "<name>" to value "<value>" from the command line. this overrides compiled-in defaults and options read from the configuration file. if a name or a value includes a space, wrap the whole --option=name=value into quotes. quotes, bestie, don't forget them ๐Ÿ™ˆ
  • -l|--log-basename=logdirectory โ€” base directory name for log/debug files. the extension ".progname" will be appended (e.g. log.smbclient, log.smbd, etc...). the log file is never removed by the client. it just... stays. forever. iconic clingy behaviour ๐Ÿซถ
  • --leak-report โ€” enable talloc leak reporting on exit.
  • --leak-report-full โ€” enable full talloc leak reporting on exit. the deluxe version ๐Ÿ’…
  • -V|--version โ€” prints the program version number.
  • -?|--help โ€” print a summary of command line options.
  • --usage โ€” display brief usage message.

๐Ÿ“ FILES ๐Ÿ“

  • /etc/inetd.conf โ€” if the server is to be run by the inetd meta-daemon, this file must contain suitable startup information for the meta-daemon.
  • /etc/rc โ€” (or whatever initialization script your system uses). if running the server as a daemon at startup, this file will need to contain an appropriate startup sequence for the server.
  • /etc/services โ€” if running the server via the meta-daemon inetd, this file must contain a mapping of service name (e.g., netbios-ssn) to service port (e.g., 139) and protocol type (e.g., tcp).
  • /usr/local/samba/lib/smb.conf โ€” this is the default location of the smb.conf(5) server configuration file. other common places that systems install this file are /usr/samba/lib/smb.conf and /etc/samba/smb.conf.

this file describes all the services the server is to make available to clients. see smb.conf(5) for more information.


๐Ÿšง LIMITATIONS ๐Ÿšง

On some systems smbd cannot change uid back to root after a setuid() call. Such systems are called trapdoor uid systems. If you have such a system, you will be unable to connect from a client (such as a PC) as two different users at once. Attempts to connect the second user will result in access denied or similar. yeah. that's the trapdoor. it traps ya ๐Ÿ˜ญ


๐ŸŒˆ ENVIRONMENT VARIABLES ๐ŸŒˆ

  • PRINTER โ€” if no printer name is specified to printable services, most systems will use the value of this variable (or lp if this variable is not defined) as the name of the printer to use. this is not specific to the server, however. just a general little guy ๐ŸŽ€

๐Ÿ” PAM INTERACTION ๐Ÿ”

Samba uses PAM for authentication (when presented with a plaintext password), for account checking (is this account disabled?) and for session management. The degree to which samba supports PAM is restricted by the limitations of the SMB protocol and the obey pam restrictions smb.conf(5) parameter. When this is set, the following restrictions apply:

  • Account Validation: All accesses to a samba server are checked against PAM to see if the account is valid, not disabled and is permitted to login at this time. This also applies to encrypted logins.
  • Session Management: When not using share level security, users must pass PAM's session checks before access is granted. Note however, that this is bypassed in share level security. Note also that some older pam configuration files may need a line added for session support. check your config bestie ๐Ÿ’…

โญ VERSION โญ

This man page is part of version 4.24.7-Ubuntu-4.24.7+dfsg-1ubuntu1 of the Samba suite.


๐Ÿฉบ DIAGNOSTICS ๐Ÿฉบ

Most diagnostics issued by the server are logged in a specified log file. The log file name is specified at compile time, but may be overridden on the command line.

The number and nature of diagnostics available depends on the debug level used by the server. If you have problems, set the debug level to 3 and peruse the log files. that's the move ๐Ÿซถ

Most messages are reasonably self-explanatory. Unfortunately, at the time this man page was created, there are too many diagnostics available in the source code to warrant describing each and every diagnostic. At this stage your best bet is still to grep the source code and inspect the conditions that gave rise to the diagnostics you are seeing. detective mode activated ๐Ÿ”


๐ŸŒˆ TDB FILES ๐ŸŒˆ

okay so Samba keeps all of its data in a bunch of TDB (Trivial Database) files, and they usually live in /var/lib/samba. slay. here's the whole roster, bestie, no skips:

(*) = information that's persistent across restarts (but not necessarily important to back up, so likeโ€ฆ don't stress abt archiving it ๐Ÿ’…).

  • account_policy.tdb* โ€” NT account policy settings, like pw expiration and all that jazz โœจ
  • brlock.tdb โ€” byte range locks
  • browse.dat โ€” browse lists
  • gencache.tdb โ€” the generic caching db
  • group_mapping.tdb* โ€” group mapping information
  • locking.tdb โ€” share modes & oplocks
  • login_cache.tdb* โ€” bad pw attempts (yes it's keeping receipts ๐Ÿ“)
  • messages.tdb โ€” the Samba messaging system
  • netsamlogon_cache.tdb* โ€” cache of the user net_info_3 struct from the net_samlogon() request (when you're a domain member)
  • ntdrivers.tdb* โ€” installed printer drivers
  • ntforms.tdb* โ€” installed printer forms
  • ntprinters.tdb* โ€” installed printer information
  • printing/ โ€” directory containing a tdb per print queue of cached lpq output
  • registry.tdb โ€” Windows registry skeleton (connect via regedit.exe) ๐ŸชŸ
  • smbXsrv_session_global.tdb โ€” session information (e.g. support for 'utmp = yes')
  • smbXsrv_tcon_global.tdb โ€” share connections (used to enforce max connections, etcโ€ฆ)
  • smbXsrv_open_global.tdb โ€” open file handles (used durable handles, etcโ€ฆ)
  • share_info.tdb* โ€” share acls
  • winbindd_cache.tdb โ€” winbindd's cache of user lists, etcโ€ฆ
  • winbindd_idmap.tdb* โ€” winbindd's local idmap db
  • wins.dat* โ€” wins database when 'wins support = yes'

๐Ÿ’€ SIGNALS ๐Ÿ’€

Sending the smbd a SIGHUP makes it reload its smb.conf configuration file within a short period of time. refresh era ๐Ÿฆ‹

Now the important one, and I need you to listen: to shut down a user's smbd process, it is recommended that SIGKILL (-9) NOT be used, except as a last resort, bc that can leave the shared memory area in an inconsistent state. messy. the safe way to terminate an smbd is to send it a SIGTERM (-15) signal and wait for it to die on its own. be patient, let it go gracefully ๐Ÿซถ

The debug log level of smbd may be raised or lowered using the smbcontrol(1) program (SIGUSR[1|2] signals are no longer used since Samba 2.2). this is so you can diagnose transient problems while still running at a normally low log level. iconic.

๐Ÿšจ heads up: as the signal handlers send a debug write, they are not re-entrant in smbd. which means you should wait until smbd is in a state of waiting for an incoming SMB before issuing them. it is possible to make the signal handlers safe by un-blocking the signals before the select call and re-blocking them after, however this would affect performance. so likeโ€ฆ tradeoffs, bestie.

๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘

hosts_access(5), inetd(8), nmbd(8), smb.conf(5), smbclient(1), testparm(1), and the Internet RFC's rfc1001.txt, rfc1002.txt. In addition the CIFS (formerly SMB) specification is available as a link from the Web page https://www.samba.org/cifs/.

go read the lore fr fr ๐Ÿ“š


๐ŸŽ€ AUTHOR ๐ŸŽ€

The original Samba software and related utilities were created by Andrew Tridgell. Samba is now developed by the Samba Team as an Open Source project similar to the way the Linux kernel is developed.


and that's a wrap on the whole page, bestie ๐Ÿ’– this whole thing is Samba 4.24.7-Ubuntu-4.24.7+dfs, dated 09/13/2026, and it's SMBD(8) โ€” go forth and share your files responsibly, you absolute main character ๐Ÿ‘‘โœจ๐Ÿ’…

๐Ÿ“ฆ where this page comes from