1

Please advise how to set Postfix and Dovecot mail server to store incoming emails with owner user and group vmail:vmail while currently it stores them as the mailbox owner user and group. I tried to set

virtual_minimum_uid = 5000
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000

in /etc/postfix/main.cf (5000 is the uid of 'vmail' user),

mail_uid = vmail
mail_gid = vmail

in the /etc/dovecot/conf.d/10-mail.conf file and

userdb {
  driver = static
  args = uid=vmail gid=vmail home=/var/mail/vmail/%d/%n
}

in the /etc/dovecot/conf.d/auth-sql.conf.ext with no effect.

Siarhei
  • 21
  • 3
  • If the existing files have a different owner, change them yourself to what you expect. Then postfix and dovecot can operate on them with the vmail user – sebix Jun 06 '21 at 14:35
  • Then i would need to change owner of the incoming mail files every time i want to read the email which is about once a minute. – Siarhei Jun 06 '21 at 22:11

1 Answers1

1

This is the way I configured it and it works for me:

On postfix master.cf file, add at the end:

dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail:vmail argv=/usr/libexec/dovecot/dovecot-lda -f ${sender} -d ${user}@${nexthop}

On dovecot/conf.d/10-master.conf configure service auth on the following way:

service auth {
  unix_listener auth-userdb {
    mode = 0666
    user = vmail
    group = vmail
  }

Hope it works for you. Regards

Gontzal
  • 21
  • 4