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 not too familiar with the ins and outs of pam and LDAP authentication on a configuration side. I've used systems that use pam but I've only worked on applications, not systems themselves.

Using pam to control authentication via LDAP, does this mean that a home directory will not be created on the system?

If not, would I create users on the server or somehow push users to the system from an LDAP source?

share|improve this question
This question might be related: unix.stackexchange.com/q/106391/34796 – drs May 20 '14 at 21:10
up vote 4 down vote accepted

This is exactly what pam_mkhomedir was made for.
The pam_mkhomedir module can create the user's home directory upon login if that directory does not exist.

How to install it depends upon your distribution. But you would need to put it in one or more files in /etc/pam.d.
For example, on my system I have /etc/pam.d/system-login which is included by all other services which perform login (ssh, gdm, etc).
I would put pam_mkhomedir.so in the session stack, such as:

session     optional    pam_loginuid.so
session     required    pam_env.so 
session     optional    pam_lastlog.so 
session     include     system-auth
session     optional    pam_mkhomedir.so # <<< right here
session     optional    pam_ck_connector.so nox11
session     optional    pam_gnome_keyring.so auto_start
session     optional    pam_motd.so motd=/etc/motd

Where you put it is entirely dependent upon what else is in the stack. But you should put it before anything else which might need the home directory.

See man 8 pam_mkhomedir for the options it supports.

share|improve this answer
Awesome. Thanks for the answer. Our users currently don't log into the system, they log into a web application that is hosted on the system. Is there a trigger that can create their home directory upon an initial log in of the web app? – Nicholas Anderson May 20 '14 at 21:26
If the web application uses the pam stack, then it would work (though you might have to put it in the auth stack instead of session). If the app does not use the pam stack, then you would have to build something into the application itself. – Patrick May 20 '14 at 21:31

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.