
The instructions are pretty straight forward and are copied and pasted from a 3rd party website. while it describes RHEL it should work for CentOS.
#SSH SHELL LOGS ME OUT IMMEDIATLY PASSWORD#
(Ansible) I had a conflicting variable set in the inventory file causing it to try and use ssh key authentication instead of password authentication.Did you try the steps below.I had forgotten to configure /etc/pam.d/common-session with session optional pam_mkhomedir.so

var/log/auth.log showed the authentication succeeding but then the client side disconnected straight afterwards. I was attempting authentication using a password. PasswordAuthentication=No was set in /etc/ssh/sshd_config.Update: coming back to this answer because I've encountered other scenarios with similar or identical symptoms. Took me ages to find the answer and this question kept coming up in my searches, so I'm posting the answer here in case anyone is in the same boat in future. I had a very similar issue, it turned out that the subnet that I had put the Debian VM on was not listed in Active Directory sites and services. But then one user's command is executed while the other's session is immediately closed again and the command is NOT executed! And that happens for both, password as well as key authentication! Why is that user locked out? Any idea anyone? May 14 15:43:17 ksta-zhquest-int3 sshd: pam_unix(sshd:session): session opened for user by (uid=0) But that user can not login!Īfter the login attempts of both "service sshd status" reports. The password (for password authentication) is set and unlocked. sshd_config has neither an AllowUser/Group nor a DenyUser/Group section. Their public keys have been added to the respective ~/.ssh/authorized keys-files, the server's ny and host.allow files are empty (or rather contain only comments). They are the same (modulo the different keys of course).īoth user have a valid home directory set as well as /bin/bash as default shell. What makes things even more absurd to me is that a different user can log in without problems (with both, password or key authentication)! I painstakingly compared settings, the content of the. Note: I replaced a few appearances of the server's name and some key hashes for privacy but they were correct. Transferred: sent 2564, received 2328 bytes, in 0.0 secondsīytes per second: sent 400692.9, received 363811.6

The below output captured using ssh's -vvv option: ssh -vvv -i touch /tmp/mms_was_hereĭebug1: Next authentication method: publickeyĭebug1: Offering public key: RSA SHA256:W4i/ ĭebug2: we sent a publickey packet, wait for replyĭebug1: Server accepts key: pkalg ssh-rsa blen 279ĭebug2: input_userauth_pk_ok: fp SHA256:W4i/ĭebug3: sign_and_send_pubkey: RSA SHA256:W4i/ĭebug1: Authentication succeeded (publickey).ĭebug3: ssh_session2_open: channel_new: 0ĭebug1: channel 0: free: client-session, nchannels 1ĭebug3: channel 0: status: The following connections are open: The login seems successful (at least according to the ssh log - see below) but immediately after that the connection is closed and the intended command is not executed. I have the case here where a specific user when trying to login to a Linux server (running openSUSE 13.2 (Harlequin) (x86_64)) using a password or a private key is immediately logged out again.
