Score:2

postfix/sendmail can't read main.cf file

eg flag

I'm trying to configure a mailserver, but when i run:

echo "test email" | mail -s "test" [email protected] -aFrom [email protected]

and check tail /var/log/mail.err I get Aug 8 13:36:37 localhost postfix/sendmail[7034]: fatal: open /etc/postfix/main.cf: Permission denied.

Here are /etc/postfix folder permissions:

root@localhost:~# ls -la /etc/postfix/
total 156
drwxr-x---   5 root vmail  4096 Aug  8 13:09 .
drwxr-xr-x 112 root root   4096 Aug  8 13:33 ..
-rwxr-xr-x   1 root vmail   100 Aug  8 11:38 dynamicmaps.cf
drwxr-xr-x   2 root vmail  4096 Jun 19  2020 dynamicmaps.cf.d
-rwxr-xr-x   1 root vmail  3126 Aug  8 13:09 main.cf
-rwxr-xr-x   1 root vmail  1390 Aug  7 15:58 main.cf.orig
-rwxr-xr-x   1 root vmail 27120 Aug  7 15:24 main.cf.proto
lrwxrwxrwx   1 root root     31 Aug  7 15:25 makedefs.out -> /usr/share/postfix/makedefs.out
-rwxr-xr-x   1 root vmail  6511 Aug  8 12:27 master.cf
-rwxr-xr-x   1 root vmail  6208 Aug  7 16:17 master.cf.orig
-rwxr-xr-x   1 root vmail  6208 Aug  7 15:24 master.cf.proto
-rwxr-xr-x   1 root vmail   148 Aug  7 16:13 mysql-virtual-alias-maps.cf
-rwxr-xr-x   1 root vmail   139 Aug  7 16:12 mysql-virtual-email2email.cf
-rwxr-xr-x   1 root vmail   137 Aug  7 23:53 mysql-virtual-mailbox-domains.cf
-rwxr-xr-x   1 root vmail   135 Aug  7 16:13 mysql-virtual-mailbox-maps.cf
-rwxr-xr-x   1 root vmail 10268 Jun 19  2020 postfix-files
drwxr-xr-x   2 root vmail  4096 Aug  8 11:38 postfix-files.d
-rwxr-xr-x   1 root vmail 11532 Jun 19  2020 postfix-script
-rwxr-xr-x   1 root vmail 29872 Jun 19  2020 post-install
drwxr-xr-x   2 root vmail  4096 Jun 19  2020 sasl

I am sorry if my question is badly formatted but i am new here. I will update if it helps you.

in flag
What user is postfix using? Is it a member of the vmail group?
Paul avatar
cn flag
Directories and files in `/etc/postfix/` are usually user and group `root`, with specific exceptions such as DKIM keys, with configuration files having `0644` permissions (and private keys `0640`). I'm not an expert at all configurations, I'm just not clear why `vmail` group would need to be assigned to those files.
Paul avatar
cn flag
@GeraldSchneider In Ubuntu `postfix` installed from repos runs `chroot` in `/var/spool/postfix/`, if I understand those configurations correctly.
Romeo Ninov avatar
in flag
Do you have SELinux activated?
Michael Hampton avatar
cz flag
@RomeoNinov The post already shows SELinux is disabled.
Alien Life Form avatar
ru flag
I'd try chmod 755 /etc/postfix, for a start.
Paul avatar
cn flag
I think this user has left us, and I just noticed that SE no longer publishes the user last visit, so who knows if this user will ever return. I'm wondering if these permissions are the result of one of those pesky admin panel things?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.