This is an old revision of the document!


Virtual mailboxes on Debian Squeeze with Exim4 and Dovecot

You know how it is. Your little mail host has just sat there for a long while, slowly accreting a user here and a user there. They are all full users on the machine, so they have logins and everything, and exim is configured to deliver their mails to ~/Maildir.

And then some dangerous loon suddenly demands that you add mailboxes for people using a completely different domain. They're not really much to do with you, and certainly shouldn't be full-blown users on your host.

Time, then, to add virtual mailboxes to your poor little mail host.

There all sorts of HOWTOs on doing this, of various ages and usefulness. I'm adding this page to the malestrom just to document the configuration changes I did. Or rather, the configuration changes I ended up with.

I'm illustrating this by setting up a new domain example.mod with user tommy.atkins.

Set up virtual mailbox space and configuration

First I created a system user and group vmail to own all virtual mailboxes.

# adduser -system --home /var/local/vmail --group vmail

and a configuration directory.

# mkdir /etc/vmail

Configuration information for the domain will be under /etc/vmail/<domain. If that directory doesn't exist, the domain isn't supported.

# mkdir /etc/vmail/example.mod

The general scheme is that we have mailboxes under /var/local/vmail/<domain>/<user>/Maildir. Why Maildir? Because our existing users will continue to get mail in ~/Maildir and it keeps dovecot config a little simpler.

# mkdir -p /var/local/vmail/example.mod
# chown -R vmail:vmail /var/local/vmail

Now add two configuration files. The first, aliases, is a conventional aliases file for the domain.

# cat > /etc/vmail/example.mod/aliases
postmaster: root
webmaster: root
security: root
admin: root
root: guru@example-owner.mod

squaddie: tommy.atkins
^D

The second, passwd contains the account information for the domain. There are two items on a line, username and password hash, separated by a colon. Generate the password has using the dovecotpw utility. Just to be on the safe side, we'll ensure the password file isn't world readable.

# /usr/sbin/dovecotpw -p password
{CRAM-MD5}9186d855e11eba527a7a52ca82b313e180d62234f0acc9051b527243d41e2740
# cat > /etc/vmail/example.mod/passwd
tommy.atkins:{CRAM-MD5}9186d855e11eba527a7a52ca82b313e180d62234f0acc9051b527243d41e2740
^D
# chgrp /etc/vmail/example.mod/passwd
# chmod 0640 /etc/vmail/example.mod/passwd
 
virtualmailboxeswitheximanddovecot.1298548534.txt.gz · Last modified: 2011/02/24 11:55 by jim
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0