Getting sendmail to work

2017-11-21

or, File Permissions on Directories Matter Too

I'm filtering my mail with Sieve via Dovecot, and the filtering piece has been working, but redirection has not. I noticed the error message from dovecot-sieve first:

dovecot: lmtp(me@nathanmorrison.net): Error: ###: sieve: msgid=<###>:
    failed to redirect message to <shop@nathanmorrison.net>:
        Failed to execute sendmail (temporary failure)

Then I found this postfix error:

postfix/sendmail[15602]: fatal: open /etc/postfix/main.cf: Permission denied

OK, so sendmail needs access to a postfix config file. I figure even a low-level Linux acolyte like me should be able to figure out file permissions, right? Trouble is, ls -l /etc/postfix/main.cf shows

-rw-r--r-- 1 root root 2551 Jun  6 21:03 /etc/postfix/main.cf

Wait, that should be readable by everyone! Now I'm stumped. After a bit of Googling, though, I finally find someone who illustrates my specific problem. Checking ls -ld /etc/postfix:

drwxr-x--- 3 root root 4096 Nov 13 20:59 /etc/postifx/

Aha! The directory needs to be readable and executable by everyone in order for the dovecot user to be able to get at its contacts. chmod 755 /etc/postfix should fix this. Now I should be able to have dovecot-sieve redirect my mail from one box to another!

Some helpful links: