Courier IMAP Setup

Courier IMAP

This is a pop3 and imap daemon. The official website is at

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

  1. postfix setup with vmailbox must be setup first.

  2. Install packages

    Install courier-authlib-userdb, courier-imap-ssl, courier-pop-ssl

  3. mkdirs

    # mkdir /etc/courier
    # touch /etc/courier/userdb
    # chmod 600 /etc/courier/userdb
  4. Turn on the userdb authentication scheme. Edit /etc/courier/authdaemonrc

    set authmodulelist="authuserdb"
  5. Decide which daemons or services you will start.

Setup per email

  1. Determine uid and gid of vmail

    This will be the vmail user setup as part of postfix initial setup

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

    In the above example, the id is 1002.

  2. Add to userdb

    # userdb "" set home=/var/mail/vhosts/ \
      mail=/var/mail/vhosts/ uid=1234 gid=1234

    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/

  3. set password

    # userdbpw | userdb "" set systempw

    it will prompt you for a password.

  4. rebuild userdb

    # makeuserdb

    /etc/courier/userdb.dat will be updated

  5. reload services

    # service courier-authdaemon restart
     * Stopping Courier authentication services authdaemond
     * Starting Courier authentication services authdaemond
  6. Notify the user their account is ready. Note that their username is their FULL email address.

Published: Saturday, 26 February 2011
Updated: Tuesday, 3 December 2013