错误
利用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
重启服务
systemctl restart sshd
启动报错
如果重新启动ssh
出现错误Start operation timed out. Terminating.Failed to start openbsd secure shell server
,可以尝试如下解决办法
关闭由systemctl控制的ssh启动
systemctl stop ssh.service
删除ssh的服务配置文件
rm /lib/systemd/system/ssh.service
重载systemctl
和ssh
服务
systemctl daemon-reload
systemctl start ssh.service
祝大家好运
原文地址:https://blog.csdn.net/weixin_45266856/article/details/129754122
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。