Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have copied VM with Red Hat 6.4 in VMware vSphere Client, move it to another network and change configs for connecting to ldap servers. And now I have a problem with logging procedure through LDAP. When I try to login either locally or via ssh, system immediatly logged me out. This is the messages in /var/log/secure when I try to connect via ssh:

Feb 17 13:41:57 %hostname% sshd[1452]: Accepted password for %user_name% from port 30104 ssh2
Feb 17 13:41:57 %hostname% sshd[1452]: pam_unix(sshd:session): session opened for user %user_name% by (uid=0)
Feb 17 13:41:57 %hostname% sshd[1452]: pam_unix(sshd:session): session closed for user %user_name%

So, I know that my system can connect to LDAP (command id %username% return valid answer) and uses pam for login. Here is my /etc/pam.d/system-auth:

auth        required
auth        sufficient nullok try_first_pass
auth        requisite uid >= 500 quiet
auth        required

account     required
account     sufficient
account     required
account     required

password    requisite try_first_pass retry=3 type=
password    sufficient sha512 shadow nullok try_first_pass use_authtok
password    required

session     optional revoke
session     required
session     [success=1 default=ignore] service in crond quiet use_uid
session     required
session     optional

I think that I successfully pass through pam authorisation, because the very last instruction was executed (home directory was created). So I think something another logging me out.

I checked /etc/passwd file and it looks fine to me:

nscd:x:28:28:NSCD Daemon:/:/sbin/nologin
nslcd:x:65:55:LDAP Client User:/:/sbin/nologin

Also there is no some auth restriction in /etc/security/limits.conf

Any advice would be appreciated. Thank you!

P.S. I have no access to my old VM and cannot check is it possible to log in there.

share|improve this question

migrated from Feb 19 '14 at 21:11

This question came from our site for professional and enthusiast programmers.

My guess is that you switched networks without updating your /etc/hosts.alow – Jason Zhu Feb 17 '14 at 16:58
@JasonZhu No, hosts.allow and hosts.deny are both empty. I'm pretty sure that it is not network problem. – toshyak Feb 18 '14 at 5:13
My first step when troubleshooting LDAP auth is to validate time sync. Check that ntpd is running and you're showing a reasonable "date" response. I doubt that's the problem, but it's good to rule it out. – sallie Feb 18 '14 at 22:27
@sallie yes, you are right, there were some problems with time sync, but now I fix them and nothing changes, I still get this problem – toshyak Feb 19 '14 at 10:42
up vote 1 down vote accepted

I think, finally I find the reason of this problem: after logging in system gives to user not existing shell: /sbin/nologin. After adding this string:

map     passwd loginShell       "/bin/bash"

in /etc/nslcd.conf everything become ok.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.