Go to TogaWare.com Home Page.
GNU/Linux Desktop Survival Guide
by Graham Williams
Google

IMAP: Mail Server


To set up an IMAP mail server install task-imap which installs wu-imap. IMAP will then be running.

A sample IMAP session:



  $ telnet imaphost 143
    Trying ::1... 
    Trying 127.0.0.1... 
    Connected to localhost. 
    Escape character is '^]'. 
    * OK Microsoft Exchange IMAP4rev1 server version 5.5.2655.37 
    (imaphost.act.cmis.CSIRO.AU) ready

To test a connection:



  $ telnet localhost 143
  Trying 127.0.0.1... 
  Connected to athens. 
  Escape character is '^]'. 
  * OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION] Courier-IMAP ready. Copyright 1998-2004 Double Precision, Inc.  See COPYING for distribution information. 
  ab login kayon PaSsWoRd
  ab OK LOGIN Ok.

To create a virtual user account to access a mail account through a different user with a different password (so that you might reduce the risk of disclosing your normal login password) you can create a virtual user and store the password in a userdb database that courier-imap will use for authentication.

First, create the ``pretend'' user:

  # userdb kayonmail set home=/home/kayon mail=/home/kayon/Maildir \
           uid=kayon gid=kayon

Create a password for this user:

  # userdbpw | userdb kayonmail set imappw

Then compile the database:

  # makeuserdb

Now add authuserdb to the authorisation methods allowed and restart the authdaemon:

  # emacs -nw /etc/courier/authdaemonrc
  authmodulelist="authpam authuserdb"
  # wajig restart courier-authdaemon

Swap the order of the authpam and authuserdb if you want to check the userdb before the system password, as might be the case when your ``virtual'' username is the same as your real username. Note that the system password will also still be accepted! Thus, to avoid making that mistake, it might be best to go with a different username. However, this doesn't really fix the problem since you might simply forget and still type your system password, and it will work! You could drop authpam altogether and all users will then need to be added to userdb.

You can then check that the user and password work with a telnet to the server as described above.

To remove a user from the database:

  # userdb kayonmail del
  # makeuserdb

Copyright © 1995-2006 Graham.Williams@togaware.com
Contribue and access the PDF Version