Recently there was a need for full imap email accounts without having shell access to the mail server as we usually do at GOTO10.
There are quite a few docs out there but non of them doing exactly what I wanted to do or they did with partially different software so i had to mix and match from a few of them :
The exim setup from here, and the courier-imap setup here
First we need to configure courier imap.
Edit /etc/courier/authdaemonrc and make sure that authmodulelist contains "authuserdb"
------
authmodulelist="authpam authuserdb"
-----
Lets add a user called debby:
#userdb debby set uid=mail gid=mail home=/var/mail/virtual/goto10.org/debby/ mail=/var/mail/virtual/goto10.org/debby/Maildir
and set a password for her:
#userdbpw -md5 | userdb debby set systempw
and recreate the userdb with
#makeuserdb
We will keep all our virtual users under /var/mail/virtual/example.com so lets do :
#mkdir -p /var/mail/virtual/example.com/debby
#maildirmake /var/mail/virtual/example.com/debby/Maildir
We make sure that the user dir has the right permissions so the mail server can read and write. All the virtual users have the uid/gid of the mail server (8 in debian).
# chown -R mail:mail /var/mail/virtual/example.com/debby
and restart courier-authdaemon:
#/etc/init.d/courier-authdaemon restart
For exim4 I had to add this snippet in exim4.conf at the end of the router section after all mail for real users, mailing lists and system accounts has been dealt with.
----------
virtual_user:
debug_print = "R: virtual_user for $local_part@$domain"
driver = redirect
allow_defer
allow_fail
domains = +local_domains
local_parts = dsearch;/var/mail/virtual/$domain
data = /var/mail/virtual/$domain/$local_part/Maildir/
directory_transport = address_directory
pipe_transport = address_pipe
file_transport = address_file
user = mail
group = mail
-----------
If we edit the exim config file we have to restart exim4
#/etc/init.d/exim4 restart