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?




map passwd homeDirectory "/home/$uid"

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


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.

  • 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      pam_mkhomedir.so   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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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