Server Fault is a question and answer site for system and network administrators. 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 set up remote LDAP server (Server1) and SSH with pam_ldap on Server2. Everything is working ok, I can login to SSH with LDAP credentials. But when I want to add new user, I have to firstly create it in LDAP databases and then run adduser on Server2.

How can I automatically create the user account on Server2 after adding it to LDAP database ? For example when the user first logs in? Thanks.

share|improve this question
up vote 12 down vote accepted

You don't need to actually make the user on the server2, only their home directory on first login. You're looking for pam_mkhomedir:

Google will find you many howtos and examples on getting this set up.

share|improve this answer

Have you enabled the LDAP module for NSS?

See here on how to do this:

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.