testparm
Validate Samba configuration file
SYNOPSIS
testparm [-s|--suppress-ok-results] [-v|--verbose] [-l|--log-basename
PARAMETERS
-s|--suppress-ok-results
Suppress output indicating syntactically correct lines in the configuration file.
-v|--verbose
Produce more verbose output including a dump of the raw configuration data before processing.
-l|--log-basename
Specify a log file basename for debugging messages.
-h|--help
Display a summary of command line options.
-d
Set the debug level. Higher values produce more output.
--parameter-name
Show the value of a particular parameter, exiting if the parameter is not present.
--section-name
Show the parameters that belong to a particular section.
--show-all-parameters
Show all parameters with their values, including defaults.
--show-defaults
Show default values of parameters. Use with caution, defaults may change with Samba versions.
--include-defaults
Include default values when displaying the configuration.
--dump-config
Dump the entire configuration in a parsable format.
--convert-names
Convert names to lowercase before processing the configuration.
Path to the Samba configuration file to check (default: /etc/samba/smb.conf).
Optional hostname to use for name resolution.
Optional IP address to use for name resolution.
DESCRIPTION
The testparm command is a vital tool for Samba administrators. It checks the syntactic correctness of a Samba configuration file (smb.conf) and reports on any potential errors or warnings. Beyond basic syntax checking, testparm can also simulate how Samba will interpret the configuration, revealing shares, user settings, and other operational details. This helps identify misconfigurations before they cause problems on a live Samba server. testparm is especially useful after modifying the `smb.conf` file, ensuring that the changes don't introduce unexpected behavior or prevent Samba from starting correctly. It reads and processes the configuration, displays the loaded services and parameters, and flags any issues related to permission conflicts, invalid options, or other configuration errors. It essentially provides a dry run of the Samba configuration, which is crucial for maintaining a stable and secure file-sharing environment.
EXIT STATUS
testparm returns 0 if the configuration file is syntactically correct and can be loaded. It returns a non-zero value if there are errors or warnings.