SSH登录失败常见问题

ssh 用户名@IP

Unable to negotiate with … port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1

添加秘钥交换算法支持

ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 用户名@IP

Unable to negotiate with … port 22: no matching host key type found. Their offer: ssh-dss

报错是因为OpenSSH 7.0以后的版本不再支持ssh-dss (DSA)算法

ssh -oHostKeyAlgorithms=+ssh-dss 用户名@IP

Unable to negotiate with … port 22: no matching cipher found. Their offer: aes128-cbc,aes192-cbc,aes256-cbc,3des-cbc

添加密码加密方法支持

ssh -v aes128-cbc 用户名@IP

ssh_dispatch_run_fatal: Connection to … port 22: Invalid key length

OpenSSH版本升级到了7.6之后,小于1024bits的RSA keys已经不被支持了。

参考链接:https://www.openssh.com/releasenotes.html

解决方法

重新生成了一个长度为2048bit的新ssh keypair,并将公钥添加到服务器端,就可以解决该问题。

这个Invalid key length的错误,只是ssh客户端的行为,如果不换key,而使用一个允许小于1024bit的ssh客户端,原有的key仍然是可以登陆服务器的。

原文地址:https://www.cnblogs.com/java-meng/p/15189274.html