Problem with POP3/SMTP Dovecot can't mkdir - Permission denied

I have clean installation Debian 5.0 lenny and Virtualmin 3.76 GPL.
I created new virtual server and e-mail user.
I can send emails with TLS but I’ve got problem with receiving through POP3/SMTP (with SSL).

Log after connecting from MS Outlook 2007 in /var/log/mail.log:
Feb 23 09:32:03 hostname dovecot: pop3-login: Login: user=<user.domain>, method=PLAIN, rip=xxx.xxx.xxx.xxx, lip=xxx.xxx.xxx.xxx, TLS
Feb 23 09:32:03 hostname dovecot: POP3(user.domain): mkdir(/var/lib/dovecot/index/user.domain/.INBOX) failed: Permission denied
Feb 23 09:32:03 hostname dovecot: POP3(user.domain): mkdir(/var/lib/dovecot/control/user.domain/.INBOX) failed: Permission denied
Feb 23 09:32:03 hostname dovecot: POP3(user.domain): mkdir(/var/lib/dovecot/index/user.domain/.INBOX) failed: Permission denied
Feb 23 09:32:03 hostname dovecot: POP3(user.domain): mkdir(/var/lib/dovecot/control/user.domain/.INBOX) failed: Permission denied
Feb 23 09:32:03 hostname dovecot: POP3(user.domain): Couldn’t open INBOX: Internal error occurred. Refer to server log for more information. [2010-02-23 09:32:03]
Feb 23 09:32:03 hostname dovecot: POP3(user.domain): Couldn’t open INBOX top=0/0, retr=0/0, del=0/0, size=0

When I am logging to Usermin I can’t read e-mails too. there is red message:
An error occurred listing mail in this folder : Failed to login to POP3 server : Internal error occurred. Refer to server log for more information. [2010-02-23 09:31:38]
and logs after this IMAP connection:
Feb 23 09:31:38 hostname dovecot: imap-login: Login: user=<user.domain>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured
Feb 23 09:31:38 hostname dovecot: imap-login: Login: user=<user.domain>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured
Feb 23 09:31:38 hostname dovecot: IMAP(user.domain): mkdir(/var/lib/dovecot/index/user.domain/.INBOX) failed: Permission denied
Feb 23 09:31:38 hostname dovecot: IMAP(user.domain): mkdir(/var/lib/dovecot/index/user.domain/.INBOX) failed: Permission denied
Feb 23 09:31:38 hostname dovecot: IMAP(user.domain): mkdir(/var/lib/dovecot/control/user.domain/.INBOX) failed: Permission denied
Feb 23 09:31:38 hostname dovecot: IMAP(user.domain): mkdir(/var/lib/dovecot/index/user.domain/.INBOX) failed: Permission denied
Feb 23 09:31:38 hostname dovecot: IMAP(user.domain): mkdir(/var/lib/dovecot/control/user.domain/.INBOX) failed: Permission denied
Feb 23 09:31:38 hostname dovecot: IMAP(user.domain): mkdir(/var/lib/dovecot/control/user.domain/.INBOX) failed: Permission denied
Feb 23 09:31:38 hostname dovecot: IMAP(user.domain): mkdir(/var/lib/dovecot/index/user.domain/.INBOX) failed: Permission denied
Feb 23 09:31:38 hostname dovecot: IMAP(user.domain): mkdir(/var/lib/dovecot/control/user.domain/.INBOX) failed: Permission denied
Feb 23 09:31:38 hostname dovecot: IMAP(user.domain): mkdir(/var/lib/dovecot/index/user.domain/.INBOX) failed: Permission denied
Feb 23 09:31:38 hostname dovecot: IMAP(user.domain): mkdir(/var/lib/dovecot/control/user.domain/.INBOX) failed: Permission denied
Feb 23 09:31:38 hostname dovecot: IMAP(user.domain): mkdir(/var/lib/dovecot/index/user.domain/.INBOX) failed: Permission denied
Feb 23 09:31:38 hostname dovecot: IMAP(user.domain): mkdir(/var/lib/dovecot/control/user.domain/.INBOX) failed: Permission denied
Feb 23 09:31:38 hostname dovecot: IMAP(user.domain): mkdir(/var/lib/dovecot/index/user.domain/.INBOX) failed: Permission denied
Feb 23 09:31:38 hostname dovecot: IMAP(user.domain): mkdir(/var/lib/dovecot/control/user.domain/.INBOX) failed: Permission denied
Feb 23 09:31:38 hostname dovecot: IMAP(user.domain): Connection closed
Feb 23 09:31:38 hostname dovecot: IMAP(user.domain): Connection closed

Permissions in /var/lib/dovecot:
hostname:/var/lib/dovecot# ls -l
total 12
drwxrwxrwx 2 root root 4096 Feb 23 08:28 control
drwxrwxrwx 2 root root 4096 Feb 23 08:28 index
-rw-r–r-- 2 root root 230 Feb 23 08:28 ssl-parameters.dat

I did’n modify any files after installation.
What can be wrong? This is a bug?

I read that changing in /etc/dovecot/dovecot.conf maildir from:
mail_location = maildir:~/Maildir:INDEX=/var/lib/dovecot/index/%u:CONTROL=/var/lib/dovecot/control/%u to mail_location = maildir:~/Maildir
solve the problem, but I think that it isn’t the best way.

Have you got the same problem?

The two ways to solve it are what you did, or changing the permissions of the dirs it’s mentioning in /var/lib/dovecot to “777”.

Either work, though I prefer what you had done there, that’s what I have setup on my box :slight_smile: Putting the control files in the home directories prevents the needs for setting up anything with 777 permissions.

-Eric

When copying SSL cert to dovecot it add the following lines

mail_location = maildir:~/Maildir:INDEX=/var/lib/dovecot/index/%u:CONTROL=/var/lib/dovecot/control/%u

Need to remove this to make it work again.

I had the same problem…

chmod /var/lib/dovecot 755

drwxr-xr-x 4 dovecot dovecot 4096 Jun 25 05:05 dovecot
did the trick…

(previously the permission were 750)
drwxr-x— 4 dovecot dovecot 4096 Jun 25 05:05 dovecot

Cheers,
CG

It’s work. I change the values
mail_location = maildir:~/Maildir:INDEX=/var/lib/dovecot/index/%u:CONTROL=/var/lib/dovecot/control/%u
to
mail_location = maildir:~/Maildir
and solve the problem
(note: I test in CentOS 5.5)