SecureCRT使用SSH登录服务器报错:Key exchange failed
创始人
2025-01-20 21:03:09
0

SecureCRT使用SSH登录Ubuntu服务器报错:Key exchange failed

原因:
ssh客户端与服务器的公钥协商失败,SecureCRT客户端所指定的秘钥交换算法(KexAlgorithms ),不在服务端支持范围内。可能是服务端的sshd版本比较高、默认配置不支持一些比较旧的秘钥交换算法。

SecureCRT 7.0 仅支持下面几种:



解决方案:
方案1)升级SecureCRT到更高的版本。

方案2)修改sshd服务端配置、指定秘钥交换算法列表。以 ubuntu 为例:

vi /etc/ssh/sshd_config

在配置文件末尾追加配置(如果已经存在、就修改 KexAlgorithms  配置)如下:

# for SecurCRT (version < 8) ssh client
KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diff
ie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1

或者配置:
KexAlgorithms +diffie-hellman-group-exchange-sha256,diffie-hellman-group1-sha1

重启服务:service sshd restart

方案3)如果无法本地登录管理服务端、只能ssh访问服务端的话,那可以试试用其他ssh客户端软件(支持服务端秘钥交换算法)先登录、修改服务端sshd配置文件、重启服务,然后就可以通过SecureCRT客户端登录了。
例如,如果安装了git,可以用git自带的 ssh.exe 登录、修改服务端配置。
cmd 命令行执行 ssh.exe 登录:
cd c:\Program Files\Git\usr\bin\
ssh.exe root@192.168.1.100

修改sshd配置后,重启sshd服务,然后就可以用SecureCRT SSH登录了。

另外,注意:如果是银河麒麟V10,配置会有差异,如果只是修改 KexAlgorithms 还不够,还是会报错:

Key exchange failed.
No compatible key exchange method. The server supports these methods: curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256
No compatible MAC. The server supports these MACs: hmac-sha2-512,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha2-256-etm@openssh.com

后面仔细查看sshd配置文件,配置有些差异,配置有区别:

如果是银河麒麟V10系统,配置如下,需要注释掉原来的 Ciphers、MACs、KexAlgorithms 参数,然后再重新配置 KexAlgorithms 追加到末尾:
Protocol 2
LogLevel VERBOSE
PubkeyAuthentication yes
RSAAuthentication yes
IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no
PermitEmptyPasswords no
PermitUserEnvironment no
#Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
ClientAliveCountMax 0
Banner /etc/issue.net
#MACs hmac-sha2-512,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha2-256-etm@openssh.com
StrictModes yes
AllowTcpForwarding no
AllowAgentForwarding no
GatewayPorts no
PermitTunnel no
#KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256

# national algorithm standards supports
#HostKeyAlgorithms sm2

# for SecurCRT (version < 8) ssh client
KexAlgorithms 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,diffie-hellman-group14-sha1

相关内容

热门资讯

实测发现!大菠萝游戏佛手在线辅... 实测发现!大菠萝游戏佛手在线辅助怎么用,约战沙城攻略,正版辅助开挂神器(有挂透视);无需打开直接搜索...
透视最新!wepoker免费辅... 透视最新!wepoker免费辅助器,新老夫子较二八年(插件教程辅助开挂脚本);无需打开直接搜索打开薇...
专业讨论!手机字牌辅助脚本工具... 专业讨论!手机字牌辅助脚本工具,手机辅助脚本工具,固有有开挂辅助器(有挂攻略)1、下载安装好手机字牌...
重要通知!潮汕掌上娱辅助科技,... 创思维激k辅助器视频是一款专注玩家量身打造的游戏记牌类型软件,在创思维激k辅助器视频这款游戏中我们可...
我来分享!河洛杠次脚本开发,j... 我来分享!河洛杠次脚本开发,jj斗地主辅助,原生有开挂辅助工具(有挂方针);打开点击测试直接进入微信...
透视存在!佛手在线大菠萝智能辅... 大家好,今天小编来为大家解答佛手在线大菠萝智能辅助器这个问题咨询软件客服可以免费测试直接加微信(13...
盘点一款!熊猫透视辅助无需卡密... >>您好:熊猫透视辅助无需卡密版确实是有挂的,很多玩家在这款熊猫透视辅助无需卡密版游戏中打牌都会发现...
分享个大家!福建天天开心辅助工... 分享个大家!福建天天开心辅助工具,九九联盟辅助,原先有开挂辅助平台(有挂方式)您好:福建天天开心辅助...
透视软件!海贝大厅辅助下载,a... 透视软件!海贝大厅辅助下载,aapoker发牌逻辑(解密教程辅助开挂挂)您好:海贝大厅辅助下载这款游...
一起来探讨!白银胡乐辅助最简单... 一起来探讨!白银胡乐辅助最简单三个步骤,丽水都莱有辅助吗,分享辅助安装(有挂解惑);无需打开直接搜索...