10

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.

Yaron
  • 221
  • 2
  • 3
  • 15
James Benders
  • 103
  • 1
  • 1
  • 5

3 Answers3

20

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.

Khaled
  • 35,688
  • 8
  • 69
  • 98
  • 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. – James Benders Feb 27 '11 at 07:20
  • So, the file does not exist. You need to create it or find the correct one. – Khaled Feb 27 '11 at 07:22
  • Thanks for your reply, I updated my answer. Please see it above. – James Benders Feb 27 '11 at 07:25
  • This is unclear. Please, edit your question instead! Did you create the file using `touch`? This may not be appropriate. – Khaled Feb 27 '11 at 07:51
  • Ok, done. Yes I used touch, how should I create it otherwise? – James Benders Feb 27 '11 at 07:55
  • I updated my answer. Have another look. – Khaled Feb 27 '11 at 08:45
  • 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! – James Benders Feb 28 '11 at 05:40
10

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

Tom Carchrae
  • 209
  • 2
  • 6
0

Change the owner

chown root:wheel policy_file

CesareoAguirre
  • 161
  • 1
  • 3