简介
本文介绍SecureCrt连接Linux的报错问题:Key exchange failed.No compatible key-exchange method
我在使用SecureCrt连接Linux时,报了如下错误:
Key exchange failed.
No compatible key-exchange method. The server supports these methods: curve25519-sha256,curve25519-sha256@libssh.org,
ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,
diffie-hellman-group18-sha512,diffie-hellman-group14-sha256
两种解决方法:
第一种: 升级SecureCRT为最新版,或者使用其他连接工具
第二种: 修改服务器,使其兼容老系统的算法
登录服务器后,在服务器里使用下面命令vi /etc/ssh/sshd_config
#加入下面的文本
KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,
diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
树莓加入相
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,curve25519-sha256@libssh.org
我是将原来的sshd_config先备份了下叫sshd_oldconfig,以防报错回去
然后将添加的文档加在这里成功了,注意,之前加在绿色框下面的时候,重启ssh的时候报错。
然后重启命令用这个:sudo /etc/init.d/ssh restart
再次用SecureCRT连接,正常了。