Score:0

CentOS 7 PAM / LDAP SSH/LOGIN user does not start in his home directory

au flag

On a CentOS 7 machine, users can use their LDAP credentials to connect to my servers. The first time they do this, the pam_mkhomedir is doing its job well. The user's folder /home/jdoe is well created with the right permission.

The issue is that when Joe connects to my server, using SSH or directly on the server monitor (just to say that it's not only a pam.d/ssh issue), its shell doesn't start in his home directory. Instead, it starts on "/home" or "/" directory.

The $HOME is the right one, if Joe does a "cd", the shell goes to "/home/jdoe" and the HomeDirectory in LDAP is the right one.

/etc/pam.d/sshd content:

#%PAM-1.0
auth       required     pam_sepermit.so
auth       substack     password-auth
auth       include      postlogin
# Used with polkit to reauthorize users in remote sessions
auth       optional     pam_reauthorize.so prepare
account    required     pam_nologin.so
account    include      password-auth
password   include      password-auth
# pam_selinux.so close should be the first session rule
session    required     pam_selinux.so close
session    required     pam_loginuid.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session    required     pam_selinux.so open env_params
session    required     pam_mkhomedir.so
session    required     pam_namespace.so
session    optional     pam_keyinit.so force revoke
session    include      password-auth
session    include      postlogin
# Used with polkit to reauthorize users in remote sessions
session    optional     pam_reauthorize.so prepare

Anyone know how to help me to find the solution ?

locobastos avatar
au flag
Ok, let's add more information. -root user has the same issue. -I've added an echo in ~/.bashrc, when the user login, the echo is not shown; when he writes bash, the echo is shown; it looks like the bash is not started with user environment. -In PAM debug log, I've `pam_unix(sshd:session): session opened` then `pam_unix(sshd:auth): authentication failure`.
locobastos avatar
au flag
On a CentOS 6 server, in which my user does not have my issue, I've the same pam_unix log. It means that this is not the root cause.
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.