Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 trying to setup linux login via an LDAP server.

I have everything working except setting the user's home directory. There is no parameter in the LDAP database that I can map to the homeDirectory attribute and I don't have the power to change the databse.

Is there any way I can configure it to use something like /home/$UID, where $UID is the username they're using to login/that's coming from the LDAP attribute uid?


share|improve this question


map passwd homeDirectory "/home/$uid"

to /etc/nslcd.conf (on Debian systems, on other systems it might be /etc/(ldap)/ldap.conf)

share|improve this answer

One option is to use something like nsscache and then have a script that runs on the cached passwd database and modifies the user home directory attributes.

share|improve this answer
Thanks - I'm going to do that for now, but it feels a little hackish. – Tom Kiley Jan 22 '10 at 15:10

Being Linux, you can try using PAM:

In /etc/pam.d/common-session put:

session required   skel=/etc/skel umask=0002

And fill in /etc/skel the home template that you want for users.

At first login, the home will be created.

You will have to deal with user deletion... their homes will remain on servers.

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.