Here is what works for me:
/etc/pam.d/dovecot ( note the pam_mkhomedir.so usage.
#%PAM-1.0 auth required pam_nologin.so auth required pam_stack.so service=system-auth account required pam_stack.so service=system-auth session required /lib/security/pam_mkhomedir.so skel=/etc/skel/ umask=077 session required pam_stack.so service=system-auth
Since dovecot does not use PAM sessions by default you need to turn this on in dovecot.conf Below is the section from my dovecot.conf
passdb pam { # [session=yes] [cache_key=<key>] [<service name>] # # session=yes makes Dovecot open and immediately close PAM session. Some # PAM plugins need this to work, such as pam_mkhomedir. # # cache_key can be used to enable authentication caching for PAM # (auth_cache_size also needs to be set). It isn't enabled by default # because PAM modules can do all kinds of checks besides checking password, # such as checking IP address. Dovecot can't know about these checks # without some help. cache_key is simply a list of variables (see # doc/variables.txt) which must match for the cached data to be used. # Here are some examples: # %u - Username must match. Probably sufficient for most uses. # %u%r - Username and remote IP address must match. # %u%s - Username and service (ie. IMAP, POP3) must match. # # If service name is "*", it means the authenticating service name # is used, eg. pop3 or imap. # # Some examples: # args = session=yes * # args = cache_key=%u dovecot args = session=yes dovecot }
The args line is the important one. I also found that is was order of the arguemtns to be important. It didn't work with " args = dovecot session=yes"
Hope this helps.
Alan
Matthias Andree wrote:
"Ben Halicki" ben.halicki@macquarietextiles.com.au writes:
Hi all,
I'm in the process of setting up dovecot, but for some reason, it's not creating home directories if they don't already exist.
I have the following line in dovecot.conf:
default_mail_env = maildir:~/mail:INBOX=/var/mail/%u
I have set permissions on /home to allow everyone full access, so creating directories in /home by dovecot non-root processes shouldn't be a problem. If I instruct dovecot to use mbox format, directories are created without a problem. The problem only seems to exist with maildir.
Any help would be greatly appreciated!
Never done this, ISTR there is a PAM module that is supposed to do this (create the directory). It would require you to use PAM, obviously.