Key exchange was not finished, connection is closed.解决办法

利用java连接Linux服务器中碰到错误:Key exchange was not finished, connection is closed.,导致服务器的连接失败,报错如下

原因

ssh中的key交换算法不兼容导致

解决办法

修改配置文件

vi /etc/ssh/sshd_config

添加如下内容

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

重启服务

service sshd restart

版权声明:
作者:郭靖
链接:https://www.sxszhian.com/archives/9198
来源:上海永驰网络科技有限公司
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
打赏
< <上一篇
下一篇>>