0

I have noticed in my logs that Postfix cannot send emails to local accounts.

postfix/local[12775]: warning: maildir access problem for UID/GID=33/33: create maildir file /var/www/Maildir/tmp/1492097290.P12775.FQDN: Permission denied
postfix/local[12775]: warning: perhaps you need to create the maildirs in advance
postfix/local[12775]: 56ABC81A28: to=<www-data@FQDN>, relay=local, delay=0.02, delays=0/0.01/0/0.01, dsn=5.2.0, status=bounced (maildir delivery failed: create maildir file /var/www/Maildir/tmp/1492097290.P12775.FQDN: Permission denied)
postfix/qmgr[8037]: 56ABC81A28: removed

I have virtual domains configured, and they work correctly. I am able to successfully send emails from one account to another.

How to change the local delivery options of Postfix to another directory other than the /var/www/?

KingsInnerSoul
  • 201
  • 3
  • 10

1 Answers1

2

This is probably caused by following conditions:

  • You have set home_mailbox = Maildir/, which is optional pathname of a mailbox file relative to a local(8) user's home directory. (Default value is empty causing delivery to /var/mail/user.)
  • User www-data has home directory /var/www, causing delivery to /var/www/Maildir/
  • /var/www is default root folder for the web server and is owned by root:root (instead of user:mail), causing the Permission denied error.

The result is actually good. If Postfix could write to that directory, all mail received by www-data could be readable through http://example.com/Maildir/. The error message in the log per se isn't something you should fix, but you have to take some time to think your mail server overall configuration and what is the desired state:

  • Is it necessary for user www-data (web server) to receive mail? Who will read it?
  • If you have virtual_alias_domains for the domains you use, do you need mydestination and local_recipient_maps at all?
  • If you do need delivery based on /etc/aliases in addition to your virtual_alias_maps, should you prevent some users to receive mail with check_recipient_access?
  • Do you really want to run own mail server? Do you have the expertise & effort? Security?

You should have all the basics together before accepting any mail from the wild Internet. Basic configuration of Postfix (just like this local delivery issue) is a crucial part of it.

Esa Jokinen
  • 46,944
  • 3
  • 83
  • 129