courier-imap Maildir folder outside usr's $HOME with pam

I am using PAM auth for imapd

Last line of:
Code:
# vi /usr/local/etc/courier-imap/imapd-ssl
Code:
MAILDIRPATH=Maildir
Means Maildir is in /usr/home/$USER/Maildir

I decided to change it to:
Code:
MAILDIRPATH=/somepath/mdstore/$USER/


It doesn't work! $USER ends up being an empty string.
So I play dumb and try:
Code:
MAILDIRPATH=/somepath/mdstore/$HOST/
And Voila! In maillog, I get error, of non existant path and $HOST did expanded to full string.

Now, I now $USER is available, even in single user mode, so something has obviously stripped/deleted it!
 
I wonder if variables like $USER and $HOME are available to this (part of the) process. A variable like $HOST is system-wide (not user-dependent), whereas $USER and $HOME are user-specific and perhaps not exported to, or imported by, this process. What is available in your current shell, may not be available to other processes ..
 
I haven't used Courier in a long time, but doesn't it automatically append the username to the maildir path if an absolute path is listed? For example, using MAILDIRPATH=/some/path would become /some/path/user1/Maildir, /some/path/user2/Maildir, /some/path/user3/Maildir, etc.

A quick search of a bunch of Courier sites doesn't come up with anything definitive. :(
 
phoenix said:
I haven't used Courier in a long time,
but doesn't it automatically append the username to the maildir path if an absolute path is listed?
For example, using MAILDIRPATH=/some/path would become /some/path/user1/Maildir,
/some/path/user2/Maildir, /some/path/user3/Maildir, etc.

A quick search of a bunch of Courier sites doesn't come up with anything definitive. :(

What you are talking about is a Postfix and it's 'mail_spool_directory' option in main.cf
If you set it to: ('/' at the end means Maildir format instead mbox format)
Code:
mail_spool_directory = /path/mail/
Then all mail is delivered in /path/mail/$USER/{.Sent new cur tmp ...}
You would just have to manually create top level dir $USER, in it {.Sent new cur tmp ...} is auto created by Postfix ;)

Back to this post:
Once user is PAM authed, he is "thrown" in $HOME, then imap folder is served, by name defined with:
Code:
MAILDIRPATH=Maildir
Anyway I fixed problem by symlinking ~/Maildir to /somepath/mdstore/$USER/
Code:
# ln -s /somepath/mdstore/$USER ~/Maildir

Reason: When PAM is used, Maildir CAN'T be outside $HOME

I don't like this solution even it works now.
So...

Code:
PROMPT# authtest bossisfag                                                                                                                                                                      0 /home/domy
Authentication succeeded.

     Authenticated: bossisfag  (system username: bossisfag)
    Home Directory: /home/bossisfag
           Maildir: (none)
             Quota: (none)
Encrypted Password: $2a$04$6DOQdG8........A4.nRF2..........wjBOmr.........g6a
Cleartext Password: (none)
           Options: wbnodsn=1
Maybe, if I would influence, 'Maildir' section, to get populated, somehow..., but where and how??
So then, that entry could be used.
 
Back
Top