> For the complete documentation index, see [llms.txt](https://linux-tutorial-cli.gitbook.io/linux-cli-tutorial/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://linux-tutorial-cli.gitbook.io/linux-cli-tutorial/txt-files/file-systems-cocepts/lpic3-300/testparm.md).

# testparm

`testparm` is a diagnostic tool in the Samba suite used to check the syntax and validity of the Samba configuration file, typically `smb.conf`. It reads the Samba configuration file and reports any errors or warnings found in the configuration. Additionally, it outputs the interpreted settings as Samba would see them, making it a valuable tool for verifying and debugging your configuration.

### Usage:

```bash
testparm [options] [configfile] [hostname]
```

* **Options**:
  * `-v, --verbose`: Show more detailed information, including default parameters.
  * `-s, --suppress-defaults`: Suppresses the display of default settings and only shows non-default configurations.
  * `--parameter-name`: Outputs the value of a specific parameter.
  * `--section-name`: Only checks the configuration of a specific section.
  * `-L, --skip-logic-checks`: Skips the logic checks for complex parameter combinations.
  * `-?, --help`: Displays help information.

### Example Commands:

1. **Basic Syntax Check**: This checks the configuration for errors and reports any issues.

   ```bash
   testparm
   ```
2. **Check a Specific Configuration File**: If your `smb.conf` is located somewhere other than the default `/etc/samba/smb.conf`, you can specify the path.

   ```bash
   testparm /path/to/smb.conf
   ```
3. **Verbose Output**: To show all configuration values, including default ones, you can run `testparm` with the verbose flag.

   ```bash
   testparm -v
   ```
4. **Suppress Default Values**: If you only want to see the non-default parameters, use the `-s` flag.

   ```bash
   testparm -s
   ```
5. **Output a Specific Parameter**: To see the value of a specific Samba parameter in your configuration, use the `--parameter-name` option.

   ```bash
   testparm --parameter-name=server role
   ```

### Use Cases:

* **Validation**: `testparm` ensures that the `smb.conf` file is free from syntax errors and correctly configured.
* **Debugging**: It helps identify misconfigurations or missing parameters.
* **Security Checks**: `testparm` can be used to verify that sensitive parameters (like file permissions, shares, etc.) are correctly set.

### Example Output:

Running `testparm` without any options will output the following:

```bash
Load smb config files from /etc/samba/smb.conf
Processing section "[global]"
Processing section "[shared]"
Loaded services file OK.
Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions
```

In this case, the output indicates that the `smb.conf` file has been processed without any errors, and the server is operating in standalone mode.

### Conclusion:

`testparm` is an essential tool for any Samba administrator to ensure that the `smb.conf` configuration is correct and that Samba services are set up properly. It helps prevent downtime caused by configuration errors and ensures the stability of the file-sharing services.
