Setup virtual users and domains on Courier (Debian package)


Courier Virtual Email Hosting – No SQL Servers

Using USERDB

  1. Add the domain(s)
    Add your domain name to esmtpacceptmailfor.dir/default
    Add your domain name to hosteddomains/default
    Then create the courier system files, run:

      makeacceptmailfor
      makehosteddomains

  2. Add the users
    You run 2 commands to add a user. (same user/pw for smtp also)
    userdb and userdbpw

    Let’s say we want to add a user account for misc@1stbyte.com.

    1st create the virtual account home dirs. I save mine in /home/virtual. You will create a sub dir for each domain, then user. And you must create the Maildir folders in this home folder. So it will look like this:
    /home/virtual/domain.com/user
    Run:
    mkdir /home/virtual/1stbyte.com/misc
    maildirmake /home/virtual/1stbyte.com/misc/Maildir
    chown -Rv 999.999 /home/virtual/1stbyte.com/misc
    userdb misc@1stbyte.com set uid=999 gid=999 home=/homevirtual/1stbyte.com/misc
    userdbpw | userdb misc@1stbyte.com set systempw

    userdbpw will ask for a password and pipe into the “set systempw” command and save it into the userdb database. You can see the data in /etc/courier/userdb.

    When you are done run: makeuserdb

  3. Setup any aliases

    if you have any aliases, set them in aliases/system. Edit the file and add full email account names like:
    vuser@domain.com: mailaccount@domian.com

    It’s alias: realaccount.
    The can be other domains too:
    fakeuser@accptedmaildomain.com: realaccount@realhosteddomain.com
    info@1stbyte.com: misc@1stbyte.com

    And of course, run: makealiases