Additional Samba Commands: smbcontrol, smbstatus, testparm, smbpasswd, nmblookup
In addition to the main Samba daemons (smbd, nmbd, and winbindd), there are several useful command-line utilities that help manage and troubleshoot Samba. These include smbcontrol, smbstatus, testparm, smbpasswd, and nmblookup.
smbcontrol
smbcontrol is used to send messages to Samba daemons (smbd, nmbd, winbindd) to control their behavior or request information.
Usage:
smbcontrol <daemon> <message-type> [parameters]Common Commands:
smbcontrol all reload-config: Reloads the configuration file for all running daemons.
smbcontrol smbd debug 10: Sets the debug level of
smbdto 10.smbcontrol winbindd ping: Sends a ping to the
winbindddaemon.
Example:
sudo smbcontrol all reload-config
smbstatus
smbstatus is used to display current Samba connections, open files, and locked files.
Usage:
smbstatus [options]Common Options:
-S: Show share mode locks.
-L: Show byte range locks.
-p: Show process IDs of the connected clients.
Example:
smbstatusOutput example:
Samba version 4.13.3 PID Username Group Machine Protocol Version Encryption Signing ---------------------------------------------------------------------------------------------------------------- 1234 john users 192.168.1.5 (ipv4:192.168.1.5:12345) NT1
testparm
testparm is a utility to check the Samba configuration file (smb.conf) for syntax errors.
Usage:
testparm [configuration file] [hostname host IP]Common Usage:
Validate the default configuration file:
testparm
Example:
testparm /etc/samba/smb.confThis checks the specified configuration file for syntax errors and displays the loaded configuration.
smbpasswd
smbpasswd is used to manage Samba user accounts and passwords.
Usage:
smbpasswd [options] [username]Common Commands:
smbpasswd -a username: Adds a new Samba user.
smbpasswd -x username: Deletes a Samba user.
smbpasswd username: Changes the password for the specified user.
Example:
sudo smbpasswd -a johnThis adds a new Samba user named
johnand prompts for a password.
nmblookup
nmblookup is used for NetBIOS name resolution, similar to nslookup but for NetBIOS names.
Usage:
nmblookup [options] nameCommon Options:
-A IP-address: Queries the specified IP address for its NetBIOS name.
-R: Sends the query as a broadcast.
Example:
nmblookup -A 192.168.1.5This queries the NetBIOS names registered by the specified IP address.
Summary of Commands and Usage
smbcontrol
Sends control messages to Samba daemons
smbcontrol all reload-config
sudo smbcontrol smbd debug 10
smbstatus
Displays current Samba connections and files
smbstatus
smbstatus
testparm
Checks Samba configuration for syntax errors
testparm
testparm /etc/samba/smb.conf
smbpasswd
Manages Samba user accounts and passwords
smbpasswd -a username, smbpasswd username
sudo smbpasswd -a john
nmblookup
Performs NetBIOS name queries
nmblookup -A IP-address
nmblookup -A 192.168.1.5
Conclusion
These Samba command-line utilities (smbcontrol, smbstatus, testparm, smbpasswd, and nmblookup) provide essential tools for managing, troubleshooting, and configuring Samba services. Understanding their usage and options enhances an administrator's ability to maintain and secure Samba servers in a network environment.
Last updated