5

I just finished setting up a Postfix SMTP and Dovecot IMAP/POP3 server.

It works perfectly fine for virtual users both sending and receiving, but I need to do the following:

Besides virtual users being able to retrieve mail, I want to be able to retrieve local users' mail too.

So, that would be getting mail from /home/[user]/Maildir

Currently Dovecot users are stored in a file in the format [user@domain]:[pass]:[uid]:[gid]

Could I somehow add local users to that file too? (I tried already, but setting the home directory does not prevent Dovecot from resolving to virtual directory, rather than /home/[user]/Maildir.)

How can I retrieve both Dovecot users' mails as well as local users' mail?

6

Yes, you can mix & match local & virtual users. I have that. Here is the settings for local users in auth-system.conf.ext

passdb {
  driver = pam
  args = failure_show_msg=yes
}

userdb {
  driver = passwd
}

http://wiki2.dovecot.org/SystemUsers

You can change the mail directory for a type of user by putting it into the userdb section. This is my mail_location in the 10-mail.conf file for local users:

mail_location = mbox:~/mail/:INBOX=/var/mail/%u

And I change it for virtual users in auth-passwdfile.conf.ext:

passdb {
  driver = passwd-file
  args = /etc/dovecot/passwd
}
userdb {
  driver = static
  args = uid=vmail gid=vmail home=/var/mail/vhosts/%d/%n mail=maildir:/var/mail/vhosts/%d/%n
}

See the various tutorials for the different types: http://wiki2.dovecot.org/HowTo

You can also set these to yes in dovecot.conf and tail /var/log/dovecot* to see what type of user it thinks it is.

#auth_verbose = yes
#auth_debug = yes

I also want to add, which isn't obvious when reading the docs, that Postfix delivers all mail to a single file for each user. However, Dovecot requires multiple files and directories for Sent, Trash, Drafts, etc. These can be in the same or totally different locations. Sometimes mail is delivered to /var/mail, and sometimes to ~/mail. The Dovecot (IMAP) folders can be in the user's home directory for system users, but what about virtual users? They either share a home directory or all their folders go into /var/vmail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.