After installing postfix and cyrus sasl sasl2-bin on ubuntu 24.04, and enabling TLS and smtpd_sasl_auth_enable in main.cf. I was still getting the error SASL PLAIN authentication failed: authentication failure, sasl_username=whatever. After a lot of messing around I finally found out that postfix wasn't even trying to talk to saslauthd.

The reason was because my sasl smtpd.conf file was in /usr/lib/sasl2/, but ubuntu postfix wants it to be in /etc/postfix/sasl.

After moving the smtpd.conf file so postfix actually used it, my error message changed to SASL LOGIN authentication failed: generic failure, sasl_username=whatever and SASL authentication failure: cannot connect to saslauthd server: No such file or directory.
This was easier to fix and was because the smtp service is running chroot, and the comments at the bottom of /etc/default/saslauthdeven tell you what path to use. After changing the path and restarting the service then things started working, almost.

The last thing to change was to update the pid file location in the service file /etc/systemd/system/multi-user.target.wants/saslauthd.service to be:

PIDFile=/var/spool/postfix/var/run/saslauthd/saslauthd.pid  

Previous Post