smbstatus
Show current Samba connections and status
SYNOPSIS
smbstatus [options]
PARAMETERS
-b, --brief
Provides a brief, summary-level output, reducing detail to focus on key information.
-d debuglevel, --debuglevel=debuglevel
Sets the debug level for the command's execution, useful for diagnosing issues. Default is 0.
-P, --profile
Displays information gathered from the smbd profiling subsystem, if enabled.
-L, --locked
Displays information only for currently locked files, which is useful for troubleshooting file access issues.
-p, --process
Lists the process IDs (PIDs) of all active smbd processes handling client connections.
-S, --shares
Outputs a list of all currently active Samba shares and the users connected to them.
-u username, --user=username
Filters the output to show information only for a specific username.
-v, --verbose
Increases the verbosity of the output, providing more detailed information.
-x, --xml
Outputs the status information in a machine-readable XML format, ideal for scripting and automation.
-f, --full
Provides a full, detailed output. This is the default behavior if no other options are specified.
DESCRIPTION
The smbstatus command is a crucial diagnostic and monitoring tool for Samba administrators. It provides a real-time overview of the current status of the Samba server (smbd). This includes a list of active SMB/CIFS connections, detailing connected users, their associated process IDs (PIDs), and the shares they are accessing. Beyond just connections, smbstatus also enumerates all currently open files, indicating which user has them open and on which share. Furthermore, it's invaluable for identifying file locks, helping to troubleshoot access issues or understand resource contention. By displaying information on active users, shared files, and locks, administrators can effectively monitor server usage, identify rogue processes, resolve file access conflicts, and ensure the smooth operation of their Samba file services.
CAVEATS
The command typically requires root privileges or sufficient permissions to access Samba's internal state files. Output can be extensive on busy servers, potentially impacting terminal readability. Information is real-time but reflects the state at the moment of execution.
OUTPUT FORMATS
By default, smbstatus presents human-readable tables detailing connections, open files, and locks. However, the -x (--xml) option allows for output in XML format, which is invaluable for programmatic parsing and integration into monitoring scripts or custom dashboards. This flexibility makes it a powerful tool for both manual inspection and automated system health checks.
COMMON USE CASES
Administrators frequently use smbstatus to:
1. Identify active users and their shares.
2. Troubleshoot 'file in use' errors by locating specific file locks.
3. Monitor server load by observing the number of active connections.
4. Debug Samba configurations by checking active shares and user access.
HISTORY
smbstatus is an integral part of the Samba suite, a free software re-implementation of the SMB/CIFS networking protocol, originally developed in the early 1990s. As Samba evolved to provide robust file and print services across heterogeneous networks, smbstatus emerged as a vital administrative tool to inspect the operational status and resource usage of the Samba daemon (smbd). Its development tracked Samba's own, focusing on providing administrators clear insights into active connections and shared resources.