Skip to content

Courier IMAP Setup

Courier IMAP is a pop3 and imap daemon.

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.

  • postfix setup with vmailbox must be setup first.
  • Install packages courier-authlib-userdb, courier-imap-ssl, courier-pop-ssl
  • mkdirs
Terminal window
# 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"
# id vmail
uid=1002(vmail) gid=1002(vmail) groups=1002(vmail)

In the above example, the id is 1002.

  • Add to userdb
Terminal window
# 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
Terminal window
# userdbpw | userdb "testuser@example.com" set systempw

it will prompt you for a password

  • rebuild userdb
Terminal window
# makeuserdb

/etc/courier/userdb.dat will be updated

  • reload services
Terminal window
# 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.