[Dovecot] Add virtual users to the Dovecot configuration
Dear Dovecot Mail List,
I have used Dovecot for quite a while to service remote users on my SOHO network. A local not-for-profit asked about getting their own dedicated domain name for mail.
I followed: http://www.howtoforge.com/linux_postfix_virtual_hosting to set up a virtual, but the article leaves out system accounts and I have not been able to access both system and virtual users at the same time. I have the following lines:
default_mail_env = maildir:/var/spool/vmail/%d/%n/ which, when commented out, works for system users default_mail_env = mbox:~/mail/:INBOX=/var/spool/mail/%u which, when commented out, which works for virtual users
If both are uncommented, only system users work.
Wiki-ing and Googling, I learned that namespace could be applied to the problem.
Here is the namespace from the configuration file.
#namespace private {
Hierarchy separator to use. You should use the same separator for all
namespaces or some clients get confused. '/' is usually a good one.
The default however depends on the underlying mail storage format.
#separator =
Prefix required to access this namespace. This needs to be
different for
all namespaces. For example "Public/".
#prefix =
Physical location of the mailbox. This is in same format as
default_mail_env, which is also the default for it.
#location =
There can be only one INBOX, and this setting defines which namespace
has it.
#inbox = yes
If namespace is hidden, it's not advertised to clients via NAMESPACE
extension or shown in LIST replies. This is mostly useful when
converting
from another server with different namespaces which you want to
deprecate
but still keep working. For example you can create hidden
namespaces with
prefixes "~/mail/", "~%u/mail/" and "mail/".
#hidden = yes #}
How do I specify which users use which namespace. Is there a good description of namespaces and how to use them?
Thanks Jens
On Wednesday 04 October 2006 15:54, Jens E. Madsen Jr. wrote:
default_mail_env = maildir:/var/spool/vmail/%d/%n/ which, when commented out, works for system users default_mail_env = mbox:~/mail/:INBOX=/var/spool/mail/%u which, when commented out, which works for virtual users
If both are uncommented, only system users work.
Wiki-ing and Googling, I learned that namespace could be applied to the problem.
It's not necessary. Rather than answer your question, I'll tell how I
do this.
In Postfix, I deliver local(8) users to a home_mailbox maildir, and virtual(8) users to a comparable spot:
/etc/postfix/main.cf :
Unix system accounts
home_mailbox = mail/
virtual mailbox accounts
virtual_mailbox_base = /home/vmail virtual_mailbox_domains = example.com virtual_mailbox_maps = hash:$config_directory/vmailbox
/etc/postfix/vmailbox : vuser1@example.com example.com/vuser1/mail/ vuser2@example.com example.com/vuser1/mail/
In Dovecot, collect from there:
/etc/dovecot.conf : default_mail_env = maildir:~/mail
and in the auth section
auth default { mechanisms = plain passdb shadow { } userdb passwd { } passdb passwd-file { args = /etc/dovecot.virtual } userdb passwd-file { args = /etc/dovecot.virtual } ... and so on
And in the Dovecot virtual passdb, you list the virtual $HOME for each user:
/etc/dovecot.virtual : vuser1:{PLAIN}pass:710:710::/home/vmail/example.com/vuser1:/bin/false: vuser2:{PLAIN}word:710:710::/home/vmail/example.com/vuser2:/bin/false:
If you're using a RDBMS, adjust to taste. It has the same idea regardless of your passdb/userdb backends. Tell Postfix to deliver to the same place you tell Dovecot to check for mail.
Offlist mail to this address is discarded unless
"/dev/rob0" or "not-spam" is in Subject: header
Dear /dev/rob0,
Thanks for your answer. This was exactly what I was trying to do except the reference I was using used one file for each of the userdb and passdb. When I attempted your suggestion below, I noticed that I was missing a colon":" I had been looking at this for days and did not see the problem.
Again, thanks for the help, Jens
/dev/rob0 wrote:
On Wednesday 04 October 2006 15:54, Jens E. Madsen Jr. wrote:
default_mail_env = maildir:/var/spool/vmail/%d/%n/ which, when commented out, works for system users default_mail_env = mbox:~/mail/:INBOX=/var/spool/mail/%u which, when commented out, which works for virtual users
If both are uncommented, only system users work.
Wiki-ing and Googling, I learned that namespace could be applied to the problem.
It's not necessary. Rather than answer your question, I'll tell how I
do this.In Postfix, I deliver local(8) users to a home_mailbox maildir, and virtual(8) users to a comparable spot:
/etc/postfix/main.cf :
Unix system accounts
home_mailbox = mail/
virtual mailbox accounts
virtual_mailbox_base = /home/vmail virtual_mailbox_domains = example.com virtual_mailbox_maps = hash:$config_directory/vmailbox
/etc/postfix/vmailbox : vuser1@example.com example.com/vuser1/mail/ vuser2@example.com example.com/vuser1/mail/
In Dovecot, collect from there:
/etc/dovecot.conf : default_mail_env = maildir:~/mail
and in the auth section
auth default { mechanisms = plain passdb shadow { } userdb passwd { } passdb passwd-file { args = /etc/dovecot.virtual } userdb passwd-file { args = /etc/dovecot.virtual } ... and so on
And in the Dovecot virtual passdb, you list the virtual $HOME for each user:
/etc/dovecot.virtual : vuser1:{PLAIN}pass:710:710::/home/vmail/example.com/vuser1:/bin/false: vuser2:{PLAIN}word:710:710::/home/vmail/example.com/vuser2:/bin/false:
If you're using a RDBMS, adjust to taste. It has the same idea regardless of your passdb/userdb backends. Tell Postfix to deliver to the same place you tell Dovecot to check for mail.
participants (2)
-
/dev/rob0
-
Jens E. Madsen Jr.