PostFix per Username Authentication

To use an authenticated user:

  1. Add or amend the following line in /etc/postfix/main.cf:

    relayhost = demo-domain.invalid

  2. Add the following to /etc/postfix/main.cf below the relayhost = line:
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    smtp_sasl_security_options = 
    smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
    smtp_use_tls = yes
  3. Create a password maps file /etc/postfix/sasl_passwd containing the login credentials:
  4. demo-domain.invalid USERNAME:PASSWORD

    Where demo-domain.invalid is replaced with your domain name and USERNAME:PASSWORD are replaced with the Authenticating User and it's password

  5. Update permissions on the sasl_passwd file to make it readable only by root user, and create the hash database:
    sudo chmod 600 /etc/postfix/sasl_passwd
    sudo postmap /etc/postfix/sasl_passwd
  6. Restart Postfix for the changes to take effect using

    /etc/init.d/postfix restart

Disclaimer: This documentation may contain references to third party software or websites. N-able has no control over third party software or content and is not responsible for the availability, security, or operation, of any third-party software. If you decide to utilize a release involving third-party software, you do so entirely at your own risk and subject to the applicable third party’s terms and conditions of the use of such software. No information obtained by you from N-able or this documentation shall create any warranty for such software.