Ldap – How to autocreate home directories in automounted NFS directory

autofshome-directoryldapnfspermissions

I have a NFS server at nfs.example.com:/users. I have a normal server at client.example.com. When I do su - user, I want it not only to automount /users/user, but I also want to create /users/user if it is not created already.

If I allows autofs to mount the home directory, I get the response: Unable to create and initialize directory '/users/user' after I attempt to su in as an LDAP user. Also, I cannot create any files inside /users.

However, if I mount the directory using mount, I do not have this permissions issue.

Is autofs mounting the NFS directory differently that normal?

Best Answer

You can try pam module such as pam_mkhomedir. Here's an example: https://access.redhat.com/solutions/1411233