Fixing postfix and saslauthd: cannot connect to saslauthd

If you are having issues getting postfix email server to authenticate with saslauthd, your solution might be found in a missing symlink.  Remember that postifx runs in a chroot environment.

I find the following warning message in /var/log/mail.log:

 warning: SASL authentication failure: cannot connect to saslauthd server: No such file or directory

The warning message tells me that saslauthd can’t be located. The real location is /var/spool/postfix/var/run/saslauthd, but postfix is expecting to find it in /var/run/saslauthd.  Create a symlink as described below and see if that fixes your problem.

sudo ln -s /var/spool/postfix/var/run/saslauthd /var/run
sudo chown root:sasl /var/spool/postfix/var/run/saslauthd
sudo usermod -a -G sasl postfix

Be sure to restart postfix and saslauthd.

sudo /etc/init.d/postfix restart
sudo /etc/init.d/saslauthd restart

After restarting saslauthd, you should see some of the following files in /var/spool/postfix/var/run/saslauthd:

cache.flock cache.mmap mux/ mux.accept

Test using your smtp client and verify that you no long receive the previous warning message in your mail.log file.  Hopefully this was your quick fix.