LinuxCommandLibrary

smbstatus

Show current Samba connections and status

SYNOPSIS

smbstatus [-b] [-d debuglevel] [-p] [-P] [-s ] [-u ] [-U ] [-v] [-V]

PARAMETERS

-b
    Brief mode: Displays only the user ID, process ID, client machine, and opened files.

-d debuglevel
    Set the debug level. debuglevel must be between 0 and 10.

-p
    Show the process ID of each process accessing shared files/directories.

-P
    Dump process table to a parsable format.

-s
    Specify the configuration file to use instead of the default.

-u
    Only show connections and locks for the specified user.

-U
    Synonym for -u, specify the username.

-v
    Verbose mode: Shows more detailed information, including share names.

-V
    Display the version number of the smbstatus command.

DESCRIPTION

The smbstatus command is a utility used to display the current status of Samba connections to a server. It provides information about active SMB/CIFS connections, locked files, and shared resources. It can be used to identify which users are connected to the Samba server, which files they have open, and from which IP addresses they are connecting. This tool is particularly useful for administrators managing Samba servers, as it helps in troubleshooting connection issues, monitoring resource usage, and understanding who is accessing which shared files.

smbstatus retrieves its data from the Samba server's internal status files, ensuring an accurate reflection of the server's current state. It can be used to view overall server activity or to focus on specific aspects like file locking or particular users. When no options are specified, smbstatus displays a summary of all current connections, file locks, and share processes.

RETURN CODES

Returns 0 on success. Anything else is regarded as an error.

USING SMBSTATUS WITH A CUSTOM PORT

By default, smbstatus connects to the 'netbios name server' port (usually 137) on localhost. If Samba is running on a custom port, this connection will fail. To fix it you can manually set an env variable:
env DUMP_PROCESS_TABLE_NETBIOS_PORT=xxxx smbstatus -P
where xxxx is the custom port.

HISTORY

The smbstatus command has been a core component of the Samba suite since its early days. It evolved alongside Samba to provide essential monitoring capabilities for network administrators. Initially a simple tool for displaying basic connection information, smbstatus has been enhanced over time to include more detailed output, filtering options, and parsable formats, reflecting the increasing complexity and sophistication of Samba deployments. It remains a critical utility for managing and troubleshooting Samba-based file sharing services.

SEE ALSO

smbd(8), nmbd(8), testparm(1)

Copied to clipboard