I've been trying to get dovecot working with postfix with virtual domain setting. I noticed that if I started dovecot with "sudo /usr/sbin/dovecot", everything would work fine. But if I started with "sudo /etc/init.d/dovecot start", I would get the following permission error. I checked "ps -ef | grep dovecot" and didn't find anything different.
Sep 29 16:54:35 localhost imap-login: Login: xyz@example.com [::ffff: 192.168.0.4 http://192.168.0.4] Sep 29 16:54:36 localhost imap(xyz@example.com): mkdir_parents(/var/spool /virtual_mailboxes/example.com/xyz/.imap/INBOX) failed: Permission denied
Here's the directory for storing virtual domain email.
[localhost ~]$ sudo ls -al /var/spool/virtual_mailboxes/example.com total 24 drwx------ 3 vuser vuser 4096 Sep 29 16:43 . drwxrwxr-x 3 root mail 4096 Sep 21 21:57 .. drwx------ 3 vuser vuser 4096 Sep 29 16:55 xyz
[localhost ~]$ sudo ls -al /var/spool/virtual_mailboxes/example.com/xyz total 32 drwx------ 3 vuser vuser 4096 Sep 29 16:55 . drwx------ 3 vuser vuser 4096 Sep 29 16:43 .. -rw------- 1 vuser vuser 1209 Sep 29 19:10 Inbox