[Dovecot] Add virtual users to the Dovecot configuration

/dev/rob0 rob0 at gmx.co.uk
Thu Oct 5 05:26:55 UTC 2006


On Wednesday 04 October 2006 15:54, Jens E. Madsen Jr. wrote:
> default_mail_env = maildir:/var/spool/vmail/%d/%n/    which, when
> commented out, works for system users
> default_mail_env = mbox:~/mail/:INBOX=/var/spool/mail/%u     which,
> when commented out, which works for virtual users
>
> If both are uncommented, only system users work.
>
> Wiki-ing and Googling, I learned that namespace could be applied to
> the problem.

It's not necessary. Rather than answer your question, I'll tell how I  
do this.

In Postfix, I deliver local(8) users to a home_mailbox maildir, and 
virtual(8) users to a comparable spot:

/etc/postfix/main.cf :
# Unix system accounts
home_mailbox = mail/
# virtual mailbox accounts
virtual_mailbox_base = /home/vmail
virtual_mailbox_domains = example.com
virtual_mailbox_maps = hash:$config_directory/vmailbox

/etc/postfix/vmailbox :
vuser1 at example.com	example.com/vuser1/mail/
vuser2 at example.com	example.com/vuser1/mail/

In Dovecot, collect from there:

/etc/dovecot.conf :
default_mail_env = maildir:~/mail
# and in the auth section
auth default {
  mechanisms = plain
  passdb shadow {
  }
  userdb passwd {
  }
  passdb passwd-file {
    args = /etc/dovecot.virtual
  }
  userdb passwd-file {
    args = /etc/dovecot.virtual
  } ... and so on

And in the Dovecot virtual passdb, you list the virtual $HOME for each 
user:

/etc/dovecot.virtual :
vuser1:{PLAIN}pass:710:710::/home/vmail/example.com/vuser1:/bin/false:
vuser2:{PLAIN}word:710:710::/home/vmail/example.com/vuser2:/bin/false:

If you're using a RDBMS, adjust to taste. It has the same idea 
regardless of your passdb/userdb backends. Tell Postfix to deliver to 
the same place you tell Dovecot to check for mail.
-- 
    Offlist mail to this address is discarded unless
    "/dev/rob0" or "not-spam" is in Subject: header


More information about the dovecot mailing list