[Dovecot] Using mail_chroot and default_mail_env

Daniel Kauffman sound_man_dan at fastmail.fm
Sat Aug 5 13:32:31 EEST 2006

Settings for mail_chroot and default_mail_env are not playing well together.

It seems that default_mail_env is verified to exist *before* the chroot 
but is later used *after* the chroot.

A configuration like this:

  * mail_chroot = /var/mail/example.com/username

  * default_mail_env = maildir:/Maildir

Fails with the message:

  * stat(/Maildir) failed: No such file or directory

As a work-around, I created an empty directory named Maildir *outside* 
of the chroot. The relevant portions of the filesystem now look 
something like this:

  * /Maildir

  * /var/mail/example.com/username/Maildir/...

  NOTE: The empty /Maildir directory is owned by root.

  NOTE: Each /var/mail/example.com/username directory and up is owned by

  NOTE: Each /var/mail/example.com/username/Maildir directory and below
        is owned by the email user.

After successful testing with the "static" settings above, I was able to 
pull the per-user settings for mail_chroot in from PostgreSQL using home 
to over-ride mail_chroot.

If anyone else has been having trouble with mail_chroot + 
default_mail_env, hopefully this work-around will help.

Finally, I should mention my system, just in case I am the only one 

  * Xen + Linux + Debian 3.1 + ( Dovecot 1.0rc2 in chroot )

Daniel Kauffman

More information about the dovecot mailing list