postmap: fatal: open database /etc/postfix/sasl_passwd.db: Permission denied

You need to make sure that postfix user is able to read that file. You can post the output of $ sudo ls -l /etc/postfix/sasl_passwd.db to get more help.

To create this file, you can use the command:

$ sudo postmap sasl_passwd

This will create the .db file.


This issue, at least on Ubuntu 12.04, is caused by the /etc/postfix folder not being owned by the postfix user. (as inferred above).

The error message is caused because you should not directly create the .db file yourself. If you did, delete it.

postmap: fatal: cannot remove zero-length database file /etc/postfix/sasl_passwd.db: Permission denied.

The simple fix to the original issue is:

sudo chown postfix /etc/postfix

After that, you can run this

sudo postmap sasl_passwd

Where it is assumed your clear text passwords are in the file sasl_passwd