I've been suffering a permission problem in Postfix/Dovecot for a
couple of days now. The setup is using virtual domains and users, so
the path to user's `home` is `/var/mail/<domain>/<user>`; and the path
to `MailDir` is `/var/mail/<domain>/<user>/MailDir`

The mail logs continue to show a *Permission Denied*:

    Apr  3 05:44:16 debian-x2 postfix/virtual[5670]: D6DDD1780100:
to=<j...@deltoid.com>,
    relay=virtual, delay=0.15, delays=0.1/0.01/0/0.04, dsn=4.2.0,
status=deferred
    (maildir delivery failed: create maildir file
    /var/mail/deltoid.com/jeff/Maildir/tmp/1396518256.P5670.debian-x2:
Permission denied)

Permissions are as follows:

    # ls -l /var/mail/
    total 96
    drw-rws--- 4 vmail  vmail  4096 Apr  2 18:19 deltoid.com
    -rw-rw---- 1 nobody mail  80586 Apr  2 07:45 nobody

    # ls -l /var/mail/deltoid.com/
    total 12
    drw-rws--- 3 vmail vmail 4096 Apr  3 04:47 jeff
    drw-rws--- 3 vmail vmail 4096 Apr  3 04:47 support
    -rw-rws--- 1 vmail vmail  122 Apr  2 03:33 users

    # ls -l /var/mail/deltoid.com/jeff/
    total 4
    drw-rws--- 2 vmail vmail 4096 Apr  3 04:47 Maildir

`vmail` is both a user and group, and its set to `id` 5000:

    # id -u vmail
    5000

`postfix` and `dovecot` are both in the `vmail` group:

    # members vmail
    vmail postfix dovecot

And Postfix's configuration is shown below.

I have a little script that attempts to set the proper permission
bits, but its apparently wrong:

    # Ensure permissions are set on directories
    chown -R vmail:vmail /var/mail/*.com
    chmod -R 0660 /var/mail/*.com
    chmod -R g+rwxs /var/mail/*.com
    # chown -R dovecot:dovecot /var/mail/*.com/users

I got the `chmod -R g+rwxs` from SuperUser questions on setting
directory permissions and having subdirectories and files inherit
those permissions (for example,
http://superuser.com/questions/264383/set-file-permissions-so-that-new-files-inherit-same-permissions,
http://stackoverflow.com/questions/580584/setting-default-permissions-for-newly-created-files-and-sub-directories-under-a,
and 
http://superuser.com/questions/151911/how-to-make-new-file-permission-inherit-from-the-parent-directory).

Two questions:

   1. What is wrong with the current permissions?

   2. What are the permissions supposed to be?

My apologies for the basic question. Many of the blog posts, tutorials
and Mini-HowTos are just not working as advertised.

Thanks in advance.

**********

# postconf -n
alias_database = hash:/etc/postfix/aliases.cf
alias_maps = hash:/etc/postfix/aliases.cf
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
delay_warning_time = 2h
inet_interfaces = all
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
mydestination = debian-x2.home.pvt, localhost.home.pvt, localhost
myhostname = debian-x2.home.pvt
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = debian-x2.home.pvt
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian 7.4)
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_gid_maps = static:5000
virtual_mailbox_base = /var/mail
virtual_mailbox_domains = /etc/postfix/domains.cf
virtual_mailbox_maps = hash:/etc/postfix/mailboxes.cf
virtual_uid_maps = static:5000

Reply via email to