I have a working setup with OpenLDAP (authentication and NFS mount options), NFS server, AutoFS (to mount the NFS homedir) and required PAM plugins.

Everything works fine except the mkhomedir PAM plugin, which does not work properly since the home directory is not being automatically created at the first login.

Here is the error message:

Aug 26 11:21:55 SERVER1 sshd[3981]: pam_mkhomedir(sshd:session): unable to create directory /home/test2: No such file or directory

And nothing on the NFS/LDAP server.

My /etc/pam.d/common-session file:

session required    pam_unix.so
session required    pam_limits.so
session optional    pam_ldap.so
session required    pam_mkhomedir.so skel=/etc/skel umask=0022

My /etc/auto.master file:

/home   ldap://,dc=XXXX,dc=local --timeout=5

Both files are on the client side.

Any ideas?



There are 2 approaches to this kind of setup:

  1. You have a shared home directory over nfs. In which case you use the AutoFS method to mount the home dir on access under /home (like you did with putting /home in auto.master)

  2. You have no shared home, and want a homedir for the user on each server he logins to. In this case you need pam_mkhomedir to create the directory upon first login.

It seems that you mixed both methods, by requesting autofs to mount /home/ and create a homedir on login.

You should choose one method and stick to it. If you want the homedir to be automounted, you'll have to create it with the user so it is available to him throught NFS.

You could try and merge the 2 methods by making /home automounted. Since that means you'll have to run AutoFS on /, perhaps it is better having /home/users automounted. Then you can have pam_mkhomedir create a homedir at /home/users/

  • Ok, so I will just create the folder after creating the account. – Henry-Nicolas Tourneur Aug 26 '09 at 10:05

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.