百度云或阿里云等Ubuntu 16.04服务器,SSH连接时报failed to negotiate client to service encryption algorithm

【现象】 

【解决方法】

如果是百度云,就用百度云账号和密码登录百度云,通过VNC远程登录到Ubuntu 16.04服务器中,修改SSH配置。

如果是阿里云,就用阿里云账号和密码登录阿里云,通过远程连接登录到Ubuntu 16.04服务器中,修改SSH配置。

阿里云和百度云修改sshd的配置文件 /etc/ssh/sshd_config都是一样的,具体如下:

在配置文件最后面添加:

Ciphers aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr,3des-cbc,arcfour128,arcfour256,arcfour,blowfish-cbc,cast128-cbc

MACs hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,hmac-sha1-96,hmac-md5-96

KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-sha1,[email protected]

例如:

重启sshd服务(重启命名为/etc/init.d/ssh restart)后,即可正常连接。

导致此问题的原因是ssh升级后,为了安全,默认不再采用原来一些加密算法,需手工添加。
 

猜你喜欢

转载自blog.csdn.net/jlq_diligence/article/details/88946416