This question already has an answer here:

I know that it was not a good idea to do update OpenSSH to v. 7.6 on Centos 6.9, but it was done. So now I can't connect to the server by ssh.

Trying to login with key:

debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 60
debug1: Server accepts key: pkalg rsa-sha2-512 blen 279
debug2: input_userauth_pk_ok: fp SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxx
debug3: sign_and_send_pubkey: RSA SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxx
debug3: send packet: type 50
Authentication failed.

Trying to login with root password:

debug2: we sent a password packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
Permission denied, please try again.

Anything else possible to do to fix this or downgrade openssh?

p.s. I'm connecting from MacOs with OpenSSH_7.5p1 and from CentOs 7 with OpenSSH_7.4p1, so my problem is not in legacy issue.


marked as duplicate by Rui F Ribeiro, Stephen Rauch, peterh, Toby Speight, mdpc Dec 14 '17 at 1:30

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    If you have another access than ssh on this server, consider looking at /var/log/secure which may be helpful ... – tonioc Dec 10 '17 at 14:12

So first of all, OpenSSH update is overwrite sshd_config file make not possible to login into the system by root (so if you do update for OpenSSH from a source - don't forget to check sshd_config before logout). But I was able to use Parallels VM Console to connect and change sshd_config but still get the same issue with connection.

The second issue what I meet is that PAM configs for sshd (/etc/pam.d/sshd) were not updated and requested old files

openssh PAM unable to dlopen(/lib64/security/pam_stack.so): /lib64/security/pam_stack.so: cannot open shared object file: No such file or directory

I tried first to use solutions which I found on the internet for this case, but at the end, I change sshd use same configs from another server with Centos7:

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_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

After this changes, I was able to login into the system.

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