14

I'm configuring Postfix to use external smtp. For this, I used this tutorial

After following it, I found in the logs that /etc/postfix/sasl_passwd.db couldn't be read. The file didn't exist. I used postmap hash:/etc/postfix/sasl_passwd (http://postfix.state-of-mind.de/patrick.koetter/smtpauth/smtp_auth_mailservers.html) as root, but I get:

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

Why do I get this?

OS: Fedora 14
User "postfix" exists.

Update:

sudo ls -l /etc/postfix/sasl_passwd.db ls:

cannot access /etc/postfix/sasl_passwd.db: No such file or directory

touch /etc/postfix/sasl_passwd.db
chmod 640 /etc/postfix/sasl_passwd.db
chown postfix:root /etc/postfix/sasl_passwd.db

sudo ls -l /etc/postfix/sasl_passwd.db

-rwxr--r--. 1 postfix root 0 Feb 19 04:16 /etc/postfix/sasl_passwd.db
-rw-r-----. 1 postfix root 0 Feb 19 04:16 /etc/postfix/sasl_passwd.db

postmap hash:/etc/postfix/sasl_passwd

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

chmod 777 gives the same error as above.

4 Answers 4

23

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.

7
  • OK, I got: sudo ls -l /etc/postfix/sasl_passwd.db ls: cannot access /etc/postfix/sasl_passwd.db: No such file or directory touch /etc/postfix/sasl_passwd.db chmod 640 /etc/postfix/sasl_passwd.db chown postfix:root /etc/postfix/sasl_passwd.db sudo ls -l /etc/postfix/sasl_passwd.db -rwxr--r--. 1 postfix root 0 Feb 19 04:16 /etc/postfix/sasl_passwd.db -rw-r-----. 1 postfix root 0 Feb 19 04:16 /etc/postfix/sasl_passwd.db postmap hash:/etc/postfix/sasl_passwd postmap: fatal: cannot remove zero-length database file /etc/postfix/sasl_passwd.db: Permission denied chmod 777 gives the same. Feb 27, 2011 at 7:20
  • So, the file does not exist. You need to create it or find the correct one.
    – Khaled
    Feb 27, 2011 at 7:22
  • Thanks for your reply, I updated my answer. Please see it above. Feb 27, 2011 at 7:25
  • This is unclear. Please, edit your question instead! Did you create the file using touch? This may not be appropriate.
    – Khaled
    Feb 27, 2011 at 7:51
  • 1
    Ok, but I got postmap: fatal: open database sasl_passwd.db: Permission denied. Then, I changed the owner of the config directory of postfix to postfix and it worked. Thanks! Feb 28, 2011 at 5:40
11

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

2
  • 1
    Confirmed still an issue @ 14.04
    – tamouse
    Sep 27, 2015 at 17:21
  • and in 16.04 lts
    – oligofren
    Feb 8, 2018 at 12:43
0

Change the owner

chown root:wheel policy_file

0

For me, to fix I had to:

1st) change the owner of the config directory of postfix to postfixs. Did this by calling:

sudo chown -R postfix:postfix /etc/postfix

2nd) called postmap:

sudo postmap /etc/postfix/sasl_passwd

And it worked. sasl_passwd.db was created.

3rd) reload postfix

sudo /etc/init.d/postfix start
sudo /etc/init.d/postfix reload

Previously I had deleted the old sasl_passwd.db file and I also stopped postfix by calling service postfix stop. Not sure if it makes any difference, but worth trying if you get any error.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .