Correcting Mail Home, Maildir and Sieve folder locations

David White dmwhite823 at protonmail.com
Sun Jun 28 13:43:33 EEST 2020


I have Dovecot 2.3.7.2 on Ubuntu 20.04.
I just migrated the server from CentOS 8, and only migrated to the CentOS 8 machine a few months ago off of CentOS 7.
I am pasting `doveconf -n` at the bottom of this email.

Everything is working.
However, I'm trying to clean up warnings in the logs, and just discovered that I'm not managing home directories properly.
(c/f https://wiki.dovecot.org/VirtualUsers/Home)

This is in the logs:

> Jun 28 06:09:50 mail.example.com dovecot: imap(email at example.com)<3786><fICEJCKpbfatQHg1>: Error: stat(/var/vmail/example.com/email at example.com/.dovecot.sieve/tmp) failed: Not a directory

Can I please get a sanity check?
To resolve, I've come up with a bash loop to create a home folder, and fix the existing structure for each mailbox on the system. 
I ran this for 1 of the domains on the system.

> for i in */ ; do mv "$i" mail; mkdir "$i"; mv mail "$i"; mv "$i"/.dovecot* "$i"; done

Then, I would simply edit /etc/dovecot/conf.d/10-mail.conf so that it looks like this:

> mail_home = /var/vmail/%d/%u
> mail_location = maildir:/var/vmail/%d/%u/mail

To confirm, should all of the 'hidden' dovecot files be moved to the user's new home folder like I'm trying to do in the above script?
Or are there other files that I will need to move?

After running that loop above on a test server (don't worry, I would never do this in production without testing), one of the mailbox's home folder on the server looks like this:

> total 56
> drwxr-xr-x   4 vmail vmail  4096 Jun 28 06:19 .
> drwx------   6 vmail vmail  4096 Jun 28 06:09 ..
> -rw-------   1 vmail vmail    54 Jul  4  2019 .dovecot.lda-dupes
> lrwxrwxrwx   1 vmail vmail    21 May 26  2016 .dovecot.sieve -> sieve/roundcube.sieve
> -rw-------   1 vmail vmail     0 Oct 17  2016 .dovecot.sieve.log
> -rw-------   1 vmail vmail   218 Jul  6  2019 .dovecot.svbin
> drwx------ 277 vmail vmail 32768 Jun 28 06:19 mail
> drwx------   3 vmail vmail  4096 Feb  2 17:31 sieve

... and connecting to that mailbox over Thunderbird seems to be working fine.
But I want to make sure I'm not missing anything.

Here is my doveconf -n, with identifying information snipped out:

> root at mail:# doveconf -n
> # 2.3.7.2 (3c910f64b): /etc/dovecot/dovecot.conf
> # Pigeonhole version 0.5.7.2 ()
> # OS: Linux 5.4.0-39-generic x86_64 Ubuntu 20.04 LTS ext4
> # Hostname: {snip}
> auth_mechanisms = plain login
> mail_location = maildir:/var/vmail/%d/%u
> managesieve_notify_capability = mailto
> managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext
> namespace inbox {
>   inbox = yes
>   location =
>   mailbox Drafts {
>     auto = subscribe
>     special_use = \Drafts
>   }
>   mailbox Junk {
>     special_use = \Junk
>   }
>   mailbox Sent {
>     auto = subscribe
>     special_use = \Sent
>   }
>   mailbox "Sent Messages" {
>     special_use = \Sent
>   }
>   mailbox Spam {
>     auto = create
>     special_use = \Junk
>   }
>   mailbox Trash {
>     auto = subscribe
>     special_use = \Trash
>   }
>   prefix =
> }
> passdb {
>   args = /etc/dovecot/dovecot-sql.conf.ext
>   driver = sql
> }
> plugin {
>   sieve = file:~/sieve;active=~/.dovecot.sieve
> }
> protocols = imap pop3 lmtp sieve
> service auth-worker {
>   user = $default_internal_user
> }
> service auth {
>   unix_listener /var/spool/postfix/private/auth {
>     group = postfix
>     mode = 0666
>     user = postfix
>   }
>   unix_listener auth-userdb {
>     group = postfix
>     mode = 0666
>     user = vmail
>   }
> }
> service lmtp {
>   unix_listener /var/spool/postfix/private/dovecot-lmtp {
>     group = postfix
>     mode = 0666
>     user = postfix
>   }
> }
> ssl = required
> ssl_ca = </etc/ssl/certs/snip.ca-bundle
> ssl_cert = </etc/ssl/certs/snip.crt
> ssl_cipher_list = ALL:!LOW:!SSLv3:!EXP:!aNULL:!MD5
> ssl_key = # hidden, use -P to show it
> userdb {
>   args = uid=vmail gid=vmail home=/var/vmail/%d/%u
>   driver = static
> }

Sent with ProtonMail Secure Email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://dovecot.org/pipermail/dovecot/attachments/20200628/b06153c0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: publickey - dmwhite823 at protonmail.com - 0x320CD582.asc
Type: application/pgp-keys
Size: 1832 bytes
Desc: not available
URL: <https://dovecot.org/pipermail/dovecot/attachments/20200628/b06153c0/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 477 bytes
Desc: OpenPGP digital signature
URL: <https://dovecot.org/pipermail/dovecot/attachments/20200628/b06153c0/attachment.sig>


More information about the dovecot mailing list