3

I installed postfix freshly as satellite system. I need to authenticate on my mail providers smpt. There postfix needs to build a sasl database from my sasl-passwd file. But it fails to do just that. How do I fix this error (last line)?:

root@confus:/etc/postfix# echo 'smtp_sasl_auth_enable = yes' >> main.cf
root@confus:/etc/postfix# echo 'smtp_sasl_security_options = noplaintext noanonymous' >> main.cf
root@confus:/etc/postfix# echo 'smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd' >> main.cf
root@confus:/etc/postfix# ll
total 116
drwxr-xr-x   3 root   root    4096 2011-06-03 13:56 ./
drwxr-xr-x 154 root   root   12288 2011-06-03 13:33 ../
-rw-r--r--   1 root   root     318 2011-06-03 13:32 dynamicmaps.cf
-rw-r--r--   1 root   root    1562 2011-06-03 13:53 main.cf
-rw-r--r--   1 root   root    5563 2011-06-03 13:32 master.cf
-rw-r--r--   1 root   root   19509 2011-05-10 15:06 postfix-files
-rwxr-xr-x   1 root   root    8729 2011-05-10 15:06 postfix-script*
-rwxr-xr-x   1 root   root   25752 2011-05-10 15:06 post-install*
drwxr-xr-x   2 root   root    4096 2011-05-10 15:06 sasl/
-rw-------   1 confus confus    51 2011-06-03 13:56 sasl_passwd
-rw-r--r--   1 root   root      28 2011-06-03 13:43 sender_canonical
-rw-r--r--   1 root   root   12288 2011-06-03 13:47 sender_canonical.db
root@confus:/etc/postfix# postmap sasl_passwd 
postmap: fatal: open database sasl_passwd.db: Permission denied
root@confus:/etc/postfix# postmap hash:sasl_passwd 
postmap: fatal: open database sasl_passwd.db: Permission denied

inb4 'sudo': Notice the "root@confus"

Lekensteyn
  • 171,743
  • 65
  • 311
  • 401
con-f-use
  • 18,613
  • 20
  • 88
  • 142

4 Answers4

3

"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."

And from the comments: "Change the owner of the config directory of postfix to postfix and it works."

Source

Rinzwind
  • 293,910
  • 41
  • 570
  • 710
  • Indeed it does. But wow, that's just babytown frolics. Why are the permissions not set in the first place? – con-f-use Jun 03 '11 at 12:36
0

Same for me, problem is worse after this

Linux ... 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1+deb9u2 (2019-05-13) x86_64 GNU/Linux

to turn back:

chown root:root dynamicmaps.cf
chmod 644 dynamicmaps.cf

After trying again postmap sasl_passwd, sasl_passwd.db is created and looks OK

Kulfy
  • 17,416
  • 26
  • 64
  • 103
Bodo
  • 41
  • 3
  • 10
0

The postmap command calls a service running as the postfix user. If you want your map to be created in /etc/postfix a low-impact fix is to only change the group ownership of the directory. This solves the "ownership warning" and later issues.

chown postfix /etc/postfix
chmod g+rwx /etc/postfix
b0tting
  • 101
-1

Usually, this fixes this problem

   cd /etc/postfix
   sudo chown -R postfix .
   sudo chgrp -R postfix .
   sudo chmod -R ugo+rwx .

Its important to also make the postfix directory writeable by the postfix user as it sometimes tries to create or replace files here (which it should probably keep somewhere else!)

user48956
  • 631
  • 1
  • 7
  • 13
  • 1
    Made my problem worse. In addition to the "No such file or directory" error, I'm also getting: `postmap: warning: /etc/postfix/dynamicmaps.cf: file is owned or writable by non-root users -- skipping this file` – TerranRich Apr 27 '18 at 19:20