Score:0

pam_mkhomedir.so not working with nslcd + LDAP (Active Directory)

it flag

I'm trying to get pam_mkhomedir.so to create an LDAP user's local home directory upon initial login. I'm on Ubuntu 20.04 LTS.

Currently, users are added to my server via LDAP (Active Directory backend). This has been configured with nslcd + nscd. I followed this guide here to get everything configured: https://www.markturner.net/2019/09/27/ad-ldap-authentication-on-linux-hosts/

Unfortunately, I can't seem to get the user's home directories to be generated. Stranger yet, when I dig into debugging, it appears the user's home directory is straight up blank.

Here is an example when user "jgoetz" tries to connect via SSH. The user can login, groups are working fine, but the home directory can't be created:

Oct 15 21:56:10 LDAP-Test6 sshd[3425]: Accepted password for jgoetz from 10.100.98.23 port 52602 ssh2
Oct 15 21:56:10 LDAP-Test6 sshd[3425]: pam_unix(sshd:session): session opened for user jgoetz by (uid=0)
Oct 15 21:56:10 LDAP-Test6 systemd-logind[689]: New session 16 of user jgoetz.
Oct 15 21:56:10 LDAP-Test6 mkhomedir_helper: PAM unable to create directory : No such file or directory

As seen on the last line, it appears mkhomedir_helper isn't even attempting to create a directory in /home, with the resulting error.

Can anyone point me in the right direction?

Thank you for your time!

Score:0
it flag

Update: I was able to solve this by setting both the loginShell to /bin/bash and homeDirectory to /home/username attributes in Windows Active Directory (the LDAP backend in our case) per user.

Once this attribute was set, the user's home directory was created successfully by pam_mkhomedir.so

I wasn't able to get nslcd to override these values locally unfortunately, which would have been much more ideal in our case, but setting these attributes in AD directly did correct the issue.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.