nmbd Command in Linux



The nmbd command is part of the Samba suite and acts as a NetBIOS name server. It provides NetBIOS over IP naming services to clients, responding to NetBIOS name service requests.

  • nmbd functions as a server that handles NetBIOS over IP name service requests. These requests are common in SMB/CIFS clients, which include various Windows versions (such as Windows 95/98/ME, Windows NT, Windows 2000, Windows XP) and LanManager clients.
  • When SMB/CIFS clients start up, they often need to locate an SMB/CIFS server to know the IP address of a specified host. nmbd listens for these name service requests and responds with the IP address of the host on which it runs, if its NetBIOS name is specified.
  • By default, its "own NetBIOS name" is the primary DNS name of the host, but this can be customized in the Samba configuration file (conf). nmbd can also respond to broadcast queries for its name(s), and additional names can be set in the configuration file.
  • nmbd can be configured as a WINS (Windows Internet Name Server) server. As a WINS server, it creates a database of name registration requests and responds to queries from clients looking for these names. This helps in managing NetBIOS names and ensuring they are resolved to the correct IP addresses.
  • nmbd can act as a WINS proxy, relaying broadcast queries from clients that do not understand the WINS protocol to a WINS server. This function ensures that all clients, regardless of their protocol understanding, can successfully locate network resources.

In addition, nmbd participates in the browsing protocols that form the basis of the Windows "Network Neighborhood" view. This participation helps SMB/CIFS clients discover and display available network resources, facilitating easier network navigation and resource sharing.

Table of Contents

Here is a comprehensive guide to the options available with the nmbd command −

Syntax of nmbd command

The following is the general syntax for the nmbd command −

nmbd [options]

nmbd Command Options

The following are different options available for the nmbd command, including both long and short forms where applicable −

Tag Description
-D

Causes nmbd to operate as a daemon, detaching itself and running in the background, fielding requests on the appropriate port.

Default behavior when launched from a command shell. Not recommended to operate from inetd.

-F Prevents the main nmbd process from daemonizing. Child processes are still created as normal, but the main process does not exit. Suitable for running nmbd under process supervisors like supervise and svscan from daemontools, or the AIX process monitor.
-S Causes nmbd to log to standard output instead of a file.
-i Runs nmbd interactively, not as a daemon, even if executed on the command line of a shell. Logs to standard output as if the -S parameter was given.
-h, --help Prints a summary of command line options.
-H <filename> Specifies the NetBIOS lmhosts file, which lists NetBIOS names to IP addresses for use by nmbd in name resolution. The file is not used by nmbd to answer any name queries but affects NetBIOS resolution from the host. Default paths are typically /usr/local/samba/lib/lmhosts, etc.
-d, --debuglevel=level Sets the debug level (integer from 0 to 10). The default is 0. Higher values log more detail about the server's activities, with levels above 3 generating extensive log data, suitable only for developers. Overrides the log level parameter in smb.conf.
-V Prints the program version number.
-s <configuration file> Specifies the configuration file containing details required by the server, such as what printcap file to use and descriptions of all services the server is to provide. Default configuration file name is determined at compile time.
-l, --log-basename=logdirectory Base directory name for log/debug files, with the extension ".progname" appended (e.g., log.smbclient, log.smbd, etc.). The log file is never removed by the client.
-p <UDP port number> Changes the default UDP port number (normally 137) that nmbd responds to name queries on. Intended for expert users.

Files Related to nmbd Command

The following files are essential for configuring and managing the nmbd server and ensuring it operates correctly within the network environment −

File Description
/etc/inetd.conf This file contains startup information for the inetd meta-daemon. It is required if the server is to be run by inetd.
/etc/rc This initialization script contains the appropriate startup sequence for the server if it is run as a daemon at startup.
/etc/services This file maps service names (e.g., netbios-ssn) to service ports (e.g., 139) and protocol types (e.g., tcp). It is required if the server is run via the inetd meta-daemon.
/usr/local/samba/lib/smb.conf

This is the default location of the smb.conf server configuration file, which contains server-specific information and descriptions of all the services the server provides.

Other common locations include /usr/samba/lib/smb.conf and /etc/samba/smb.conf.

wins.dat When run as a WINS server, nmbd will store the WINS database in the file wins.dat in the var/locks directory configured under wherever Samba was configured to install itself.
browse.dat If nmbd is acting as a browse master , nmbd will store the browsing database in the file browse.dat in the var/locks directory configured under wherever Samba was configured to install itself.

Examples of nmbd Command in Linux

The following examples can help you understand how to use the nmbd command with various options to manage NetBIOS name services effectively.

Run nmbd as a Daemon

To run nmbd as a daemon, you can use the following command −

sudo nmbd -D

This command detaches nmbd from the terminal and runs it in the background.

nmbd Command in Linux1

Run nmbd Without Daemonizing

To run nmbd without daemonizing the main process, you can use the following command −

sudo nmbd -F

This prevents the main nmbd process from detaching from the terminal. Child processes are still created normally to handle each connection request. This mode is suitable for running nmbd under process supervisors such as supervise and svscan from daemontools.

nmbd Command in Linux2

Run nmbd Interactively

To run nmbd interactively (not as a daemon), you can use the following command −

sudo nmbd -i

This forces nmbd to run interactively and log to standard output.

nmbd Command in Linux3

Specify a NetBIOS lmhosts File

To specify a custom lmhosts file for NetBIOS name resolution, you can use the following command −

sudo nmbd -H /etc/samba/lmhosts

The lmhosts file contains NetBIOS names and their corresponding IP addresses. This file is used by nmbd for name resolution.

nmbd Command in Linux4

Set Debug Level

To set the debug level for nmbd, you can use the following command −

sudo nmbd -d 3

The debug level ranges from 0 to 10. Higher levels generate more detailed log output. This command sets the debug level to 3, which is useful for troubleshooting issues.

nmbd Command in Linux5

Use a Custom Configuration File

To specify a custom configuration file for nmbd, you can run the following command −

sudo nmbd -s /etc/samba/smb.conf

This option allows you to specify a custom smb.conf file, which contains configuration details for the server.

nmbd Command in Linux6

Conclusion

The nmbd command plays a pivotal role in managing NetBIOS over IP services, enabling seamless communication and resource sharing across SMB/CIFS networks.

Through its versatile options and configurations, nmbd can adapt to diverse network environments, offering features such as daemonized operation, interactive mode, customized log and configuration file paths, and debug-level adjustments for troubleshooting.

By mastering the syntax, options, and practical use cases of nmbd, you can optimize network's efficiency, ensure reliable name resolution, and improve resource discovery for SMB/CIFS clients.

Advertisements