今天在启动postfix的时候,查看centos中的postfix日志 more /var/log/maillog,出现了如下报错,

Apr 28 09:04:44 PaulV1 aliasesdb[23836]: /usr/sbin/postconf: fatal: parameter inet_interfaces: no local interface found for ::1
Apr 28 09:04:45 PaulV1 aliasesdb[23836]: newaliases: fatal: parameter inet_interfaces: no local interface found for ::1
Apr 28 09:04:45 PaulV1 postfix[23844]: fatal: parameter inet_interfaces: no local interface found for ::1

后来查看了下配置文件 vi /etc/postfix/main.cf

将配置为:

inet_interfaces = localhost
inet_protocols = all

改成了:

inet_interfaces = all
inet_protocols = all

接着重新启动,又出现了如下信息

Apr 28 09:09:08 PaulV1 postfix[23919]: postsuper: fatal: scan_dir_push: open directory defer: Permission denied
Apr 28 09:09:08 PaulV1 postfix/postsuper[23952]: fatal: scan_dir_push: open directory defer: Permission denied
Apr 28 09:09:10 PaulV1 postfix/postfix-script[23953]: fatal: Postfix integrity check failed!

这是因为启动时邮件服务对系统目录没有权限导致的,我们更改相关目录的所有者,然后重新启动

chown -R postfix /var/spool/postfix/

但是。启动的时候显示还有一个目录没有权限。

Apr 28 09:21:57 PaulV1 postfix/master[24146]: fatal: open lock file /var/lib/postfix/master.lock: cannot open file: Permission denied
Apr 28 09:21:58 PaulV1 postfix/master[24145]: fatal: daemon initialization failure
Apr 28 09:21:59 PaulV1 postfix/postfix-script[24147]: fatal: mail system startup failed

所以

chown -R postfix /var/lib/postfix/

最后。才启动成功了。

[root@V1 ~]# systemctl status postfix -l       
● postfix.service - Postfix Mail Transport Agent
   Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2018-04-28 09:24:31 CST; 1min 40s ago
  Process: 24175 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUCCESS)
  Process: 24172 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
  Process: 24169 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS)
 Main PID: 24250 (master)
    Tasks: 3
   Memory: 3.6M
   CGroup: /system.slice/postfix.service
           ├─24250 /usr/libexec/postfix/master -w
           ├─24251 pickup -l -t unix -u
           └─24252 qmgr -l -t unix -u

Apr 28 09:24:31 PaulV1 systemd[1]: Starting Postfix Mail Transport Agent...
Apr 28 09:24:31 PaulV1 postfix/postfix-script[24239]: warning: not owned by group postdrop: /var/spool/postfix/public
Apr 28 09:24:31 PaulV1 postfix/postfix-script[24240]: warning: not owned by group postdrop: /var/spool/postfix/maildrop
Apr 28 09:24:31 PaulV1 postfix/postfix-script[24248]: starting the Postfix mail system
Apr 28 09:24:31 PaulV1 postfix/master[24250]: daemon started -- version 2.10.1, configuration /etc/postfix
Apr 28 09:24:31 PaulV1 systemd[1]: Started Postfix Mail Transport Agent.

参考资料:

  1. 解决没有本地接口发现

  2. 邮件服务器启动postfix时的问题