Courier IMAP: Could not log in after Debian 5.0 upgrade

After I had upgraded my server to Debian 5.0, I found that I could no longer log in via IMAP. I turned authentication debugging on by changing /etc/courier/authdaemonrc as follows:

DEBUG_LOGIN=1

This did not reveal any problems. Here’s an excerpt from mail.info:

authdaemond: received auth request, service=imap, authtype=cram-md5
authdaemond: authmysql: trying this module
authdaemond: cram: challenge=[...], response=[...]
authdaemond: cram: decoded challenge/response, username 'user@example.org'
authdaemond: SQL query: SELECT username, crypt, clear, uid, gid, pop, "",
  "", realname, "" FROM users WHERE username = 'user@example.org'
authdaemond: cram validation succeeded
authdaemond: Authenticated: sysusername=<null>, sysuserid=1000,
  sysgroupid=1000, homedir=/home/user/var/mail/example.org/user,
  address=user@example.org, fullname=Joe User, maildir=<null>,
  quota=<null>, options=<null>

Even though all seemed fine, Thunderbird complained about “server doesn’t support secure authentication.”

So I telnetted into my IMAP server by issuing telnet localhost imap and manually logged in as follows:

a login user@example.org thePass

Now I noticed immediately what was wrong:

* BYE [ALERT] Fatal error: Account's mailbox directory is not owned
  by the correct uid or gid:

The solution is that Courier now by default performs stricter checks on the “sanity” of your setup. I changed /etc/courier/imapd as follows, and all was fine again:

IMAP_MAILBOX_SANITY_CHECK=0

9 thoughts on “Courier IMAP: Could not log in after Debian 5.0 upgrade”

  1. @sts Yes, it should. Someone (me?) should probably open a bug against Courier IMAP…

  2. thank you! i got stuck for over an hour at this problem.
    This should definitely be visible at debug level 1

  3. So many Google searches turned up useless info. Such a simple fix, thanks much!

Leave a Reply

Your email address will not be published. Required fields are marked *