Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm configurint Postfix to use external smtp. For this, I use the following tutorial: http://carlton.oriley.net/blog/?p=31

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.

Thanks.

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.

share|improve this question

3 Answers 3

up vote 2 down vote accepted

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.

share|improve this answer
    
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 7:20
    
So, the file does not exist. You need to create it or find the correct one. –  Khaled Feb 27 '11 at 7:22
    
Thanks for your reply, I updated my answer. Please see it above. –  James Benders Feb 27 '11 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 '11 at 7:51
    
Ok, done. Yes I used touch, how should I create it otherwise? –  James Benders Feb 27 '11 at 7:55

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

share|improve this answer

Change the owner

chown root:wheel policy_file

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.