Courier IMAP Setup

courier-imap pop3 and imap daemon with userdb setup notes

Published: Saturday, 26 February 2011
Last modified: Tuesday, 3 December 2013

Courier IMAP is a pop3 and imap daemon.

Userdb authentication setup

I’m using userdb for authentication. There are other schemes you can use such as PAM, MySQL or Postgres.

userdb is a disk based authentication, similar to standard passwd files.

Initial Setup

  • postfix setup with vmailbox must be setup first.
  • Install packages courier-authlib-userdb, courier-imap-ssl, courier-pop-ssl
  • mkdirs
# mkdir /etc/courier
# touch /etc/courier/userdb
# chmod 600 /etc/courier/userdb
  • Turn on the userdb authentication scheme. Edit /etc/courier/authdaemonrc
set authmodulelist="authuserdb"

Setup per email

# id vmail
uid=1002(vmail) gid=1002(vmail) groups=1002(vmail)

In the above example, the id is 1002.

  • Add to userdb
# userdb "testuser@example.com" set home=/var/mail/vhosts/example.com/testuser \
  mail=/var/mail/vhosts/example.com/testuser uid=1002 gid=1002

After this command you should see a new entry in /etc/courier/userdb The mail parameter is used so it is not defaulted to $home/Maildir/

  • set password
# userdbpw | userdb "testuser@example.com" set systempw

it will prompt you for a password

  • rebuild userdb
# makeuserdb

/etc/courier/userdb.dat will be updated

  • reload services
# service courier-authdaemon restart
 * Stopping Courier authentication services authdaemond
   ...done.
 * Starting Courier authentication services authdaemond
   ...done.

Notify the user their account is ready. Note that their username is their FULL email address.

Courier IMAP Setup