postmap:fatal:打开数据库/etc/postfix/sasl_passwd.db:权限被拒绝

我正在configurationPostfix来使用外部smtp。 为此,我使用了这个教程

在跟踪它之后,我在日志中发现无法读取/etc/postfix/sasl_passwd.db 。 该文件不存在。 我使用postmap哈希:/ etc / postfix / sasl_passwd( http://postfix.state-of-mind.de/patrick.koetter/smtpauth/smtp_auth_mailservers.html )作为根,但我得到:

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

我为什么得到这个?

 OS: Fedora 14 User "postfix" exists. 

更新:

 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给出与上面相同的错误。

您需要确保postfix用户能够读取该文件。 您可以发布$ sudo ls -l /etc/postfix/sasl_passwd.db的输出以获得更多帮助。

要创build这个文件,你可以使用下面的命令:

 $ sudo postmap sasl_passwd 

这将创build.db文件。

至less在Ubuntu 12.04上,这个问题是由于/ etc / postfix文件夹不属于postfix用户所致。 (如上所述)。

错误信息是由于您不应该直接创build.db文件。 如果你这样做,删除它。

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

原始问题的简单解决方法是:

 sudo chown postfix /etc/postfix 

之后,你可以运行这个

 sudo postmap sasl_passwd 

假定您的明文密码位于文件sasl_passwd中

改变所有者

chown root:wheel policy_file