
postconf Command in Linux
The postconf command in Linux displays and manages the Postfix configuration parameters. It is used to query or modify Postfix configuration parameters. It retrieves values from the main.cf configuration file and can also be used to update settings temporarily or permanently.
Table of Contents
Here is a comprehensive guide to the options available with the postconf command â
Syntax of postconf Command
The syntax of the postconf command in Linux is as follows:
postconf [options] [parameter ...]
In the above syntax, the [options] field is used to specify options to change command’s output. The [parameter…] field is used to specify the parameter name that needs to be processed.
Options of postconf Command
The options of the Linux postconf command are listed below:
Option | Description |
---|---|
-a | Lists available SASL plug-in types for the Postfix SMTP server. Supported plug-ins: cyrus (requires Cyrus SASL support), dovecot (works with any SASL support). |
-A | Lists available SASL plug-in types for the Postfix SMTP client. The type is set using smtp_sasl_type or lmtp_sasl_type. Supported plug-in: cyrus (requires Cyrus SASL support). |
-b [template_file] | Displays the message text in DSN messages, expanding $name expressions. Specify a template file to override bounce_template_file, or use an empty file name for built-in templates. |
-c config_dir | Specifies a different configuration directory for main.cf. |
-C class,... | Filters main.cf parameters by class: builtin, service, user, or all (default). |
-d | Displays default settings of main.cf instead of actual values. Use -df to fold long lines. |
-e | Edits main.cf to update parameter settings. Also allows editing master.cf using -M, -F, or -P options. The -e option is no longer needed in Postfix 2.8 and later. |
-f | Folds long lines in main.cf or master.cf for readability. |
-F | Displays master.cf service fields in service/type/field=value format. Use -Ff to fold long lines. |
-h | Shows parameter values without the name = label. |
-H | Displays parameter names only. |
-l | Lists supported mailbox locking methods: flock, fcntl, dotlock. |
-m | Lists supported lookup table types, including btree, cdb, cidr, dbm, hash, ldap, mysql, pgsql, sqlite, static, and others. |
-M | Displays master.cf contents. Use -Mf to fold long lines. Filters available based on service names or types. |
-n | Shows only explicitly set main.cf parameters. Use -nf to fold long lines. |
-o name=value | Overrides main.cf parameter settings. |
-p | Displays main.cf parameter settings (default). |
-P | Displays master.cf service parameter settings in service/type/parameter=value format. Use -Pf to fold long lines. |
-t [template_file] | Displays DSN message templates without expanding $name expressions. |
-T mode | Displays OpenSSL version (compile-version, run-version) or supported public-key algorithms. |
-v | Enables verbose logging for debugging. Multiple -v options increase verbosity. |
-x | Expands $name variables in main.cf or master.cf. |
-X | Edits main.cf or master.cf to remove specified parameters, services, or service settings. |
-# | Comment out parameters in main.cf, reverting them to default. |
Examples of postconf Command in Linux
This section explores how to use postconf command in Linux with examples:
Listing all Postfix Parameters
To display all the Postfix parameters and their current values, execute the postconf command without any option:
postconf

Displaying the Value of a Specific Parameter
To display the value of a specific parameter, use the postconf command with the parameter name:
postconf daemon_timeout

Displaying the Parameters Values Only
To display the values of the parameters only, use the -h option with the postconf command:
postconf -h

Changing the Parameter Temporarily
To modify the parameter temporarily, use the postconf command with the parameter name and its value.
sudo postconf daemon_timeout=10000s

Changing the Parameter Permanently
To modify the parameter permanently, use the -e option:
sudo postconf -e daemon_timeout=10000s

The above command updates main.cf so that changes persist.
Listing the Non-default Values of the Parameters
To display only the non-default parameters, use the -n option:
postconf -n

Displaying the Default Values of the Parameter
To display the default values of the parameters, use the -d option with the postconf command:
postconf -d

Displaying the Available SASL Methods
To display the available SASL methods, use the -a option:
postconf -a

Displaying the Supported Lookup Table Types
To display the supported lookup table types, use the -m option:
postconf -m

Removing a Custom Set Parameter Value
To remove a custom set parameter value and get back the default, use the -X option followed by the parameter name:
postconf -X daemon_timeout
Displaying the Supported Mailbox Locking Methods
To display the supported mailbox locking methods, use the -l options:
postconf -l

Commenting Out a Parameter Value
To comment out a parameter in the main.cf file, use the -# option followed by the parameter name:
postconf -# hostname

Conclusion
The postconf command in Linux is a useful tool for managing Postfix configuration parameters. It allows querying and modifying settings, retrieving values from main.cf, and making temporary or permanent changes. Various options help in displaying specific details, editing configurations, and listing available features.