expected key exchange group packet from server错误解决过程

36 篇文章 0 订阅

  昨天在虚拟机上安装了个CentOS7.4系统,装的是minimal类型。配置好ip后,就用远程连接工具去连接,结果就碰到了

文章标题中提到的错误。

先说一下我的环境吧,我用的mac电脑,系统是OS X EI Capitan 版本 10.11.6;远程连接工具是vSSH 1.7(注:看介绍

也是参考PuTTY软件开发的),sshd版本:OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017。

在用vSSH连接报错后,我尝试用mac自带的命令行ssh 去连接,但是没发现这样的问题。这样一对比,就会发现:

1.是我远程连接工具的问题 2.sshd版本或者配置的问题

然后查看错误日志:

journalctl --unit sshd --no-pager 

发现:error: kex protocol error: type 30 seq 1 [preauth]

在网上查阅了一些解决办法后,发现 https://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/rfc4419.html 这个链接

里已经解释了这个问题。

The variant of Diffie-Hellman key exchange in which the server sends a different prime modulus every time (known in

SSH as 'group exchange') was revised by RFC 4419 to change the format of the SSH_MSG_KEX_DH_GEX_REQUEST

message, and also its message number. PuTTY didn't get round to supporting the revised message for quite a long time,

but as of 0.65 it will now do so.
(The OpenSSH server is removing support for these messages. It has backwards-compatibility code for old versions

of PuTTY, but assumes that 0.65 onwards will support the revised message. If for some reason the backwards-compatibility

arrangements don't work, the symptom is a message like error: Hm, kex protocol error: type 30 seq 1 [preauth] in the SSH

server log.)

最终在这个链接 https://my.oschina.net/longquan/blog/1612533 里找到了解决办法,亲测可用。

# Add this to /etc/ssh/sshd_config
KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1
# systemctl restart sshd
原因大概就是
use libssh2, and libssh2 only support diffie-hellman key exchange methods
而且升级libssh2也不能解决,应该是个bug。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

从心所愿

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值