Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running into a weird issue setting up Postfix and Courier IMAP on a clean Ubuntu 13.04 install. I'm using this tutorial, and am currently Testing Courier IMAP.

When I try to login with root, everything's fine (this is part of a netcat connection):

a login root my-pass
a logout
* BYE Courier-IMAP server shutting down
a OK LOGOUT completed

However, when I try to login with my own account, I get an error:

a login camilstaps my-other-pass
* BYE [ALERT] Fatal error: No such file or directory: No such file or directory

The mail.log:

Jun  2 13:47:37 cs imapd: Connection, ip=[::ffff:] # this is the root login
Jun  2 13:47:51 cs imapd: LOGIN, user=root, ip=[::ffff:], port=[54630], protocol=IMAP
Jun  2 13:48:11 cs imapd: LOGOUT, user=root, ip=[::ffff:], headers=0, body=0, rcvd=9, sent=80, time=20
Jun  2 13:50:59 cs imapd: Connection, ip=[::ffff:] # this is the other login
Jun  2 13:51:07 cs imapd: chdir Maildir: No such file or directory
Jun  2 13:51:07 cs imapd: camilstaps: No such file or directory

And the mail.err, not really adding something:

Jun  2 13:51:07 cs imapd: camilstaps: No such file or directory

I configured Postfix to use the Maildir format using /var/mail/%u where %u is the username. At first, I thought the camilstaps user missed his mail folder. However, it does have one similar to root's one:

root@cs:/# tree -CdA /var/mail
├── camilstaps
│   └── Maildir
│       ├── cur
│       ├── new
│       └── tmp
└── root
    └── Maildir
        ├── cur
        ├── new
        └── tmp

Then I thought the camilstaps user had a different maildir in the MAIL constant, however...

root@cs:/# echo $MAIL
camilstaps@cs:/$ echo $MAIL

What's going on here? How can I fix this?

For what it's worth, I'm on Ubuntu Server 13.04.

With help from the comments, I found out something interesting / possibly useful:

  • There was an old Maildir in /root. When I remove that one, I get the same error when logging in as root to the IMAP server.
  • When I add a Maildir directory to the homedir of the camilstaps user, I don't get the error anymore.

For some reason, the IMAP server doesn't look in /var/mail/%u (%u = username) but in %h/Maildir (%h = homedir). The $MAIL variable has been set correctly, so what could be the problem here?

share|improve this question
Are you sure you are looking at the correct configuration file? What happens if you create Maildir in /home/camilstaps? – tripleee Jun 2 '13 at 18:00
@tripleee I'm working with /etc/postfix/main.cf, that is correct, right? When I create Maildir in /home/camilstaps, I get the same error. I think I understand what you're hitting at. I tried removing /root/Maildir and now I get the same error for root! – Camil Staps Jun 3 '13 at 17:18
@tripleee right, the homedir of the camilstaps user isn't /home/camilstaps. When I do add a Maildir to the homedir of camilstaps, it works. However, I want the Maildirs to be in /var/mail. The environment variables are set okay, so what's going on? – Camil Staps Jun 3 '13 at 17:34
The IMAP server is not examining the user's interactive environment at all. If IMAP is running as user mail then the mail user's environment variables are what's visible to the server. – tripleee Jun 4 '13 at 4:32
@tripleee I'm not sure I understand what you're saying. Do you mean I need to set IMAP as user mail? How do I do that? – Camil Staps Jun 4 '13 at 5:48
up vote 1 down vote accepted

It appears that Courier IMAP's architecture does not support Maildirs outside of $HOME.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.