I am trying to configure my server to authenticate users using LDAP and save their home directories on a NFS-Directory, also located on the server.
i.e.: I share a directory on my server:
/nfsexport 10.0.2.0/24(rw,async,no_subtree_check,fsid=0,crossmnt)\
*.em(rw,async,no_subtree_check,fsid=0,crossmnt)
/nfsexport/homes 10.0.2.0/24(rw,async,no_subtree_check)\
*.em(rw,async,no_subtree_check)
mount it on my client by editing /etc/fstab
:
server1:/homes /home/users nfs4 bg 0 0
and append at the end of the files /etc/pam.d/login
and /etc/pam.d/lightdm
following line:
session required pam_mkhomedir.so skel=/etc/skel umask=0022
Now the home directory should be created at login under /home/users/ldapuser
. But I cannot login and there is no home directory created on the server.
I tried following approaches:
- Create the home directory locally and not on the NFS. It works, owner and group are correct. But it is not centralized.
- Change the permissions of
/home/users
on the server to 777. It works also with NFS, but it is not the optimal solution... I also tried to change the permission afterwards to 755, but then the user cannot write on his home directory because the owner and group are set to nobody and nogroup
So how can I make openLDAP automatically create home directories under /home/users
with the according user- and group-ownership at first login? Or at least change it afterwards, after first logging in, while the rights are changed to 777?
Or: Is there an alternative method to have centralized home directories and user authentication?