錯(cuò)誤
利用java
連接Linux
服務(wù)器中碰到錯(cuò)誤:Key exchange was not finished, connection is closed.
,導(dǎo)致服務(wù)器的連接失敗,報(bào)錯(cuò)如下
原因
是ssh
中的key
交換算法不兼容導(dǎo)致
解決辦法
修改配置文件
vi /etc/ssh/sshd_config
添加如下內(nèi)容
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
重啟服務(wù)
systemctl restart sshd
啟動(dòng)報(bào)錯(cuò)
如果重新啟動(dòng)ssh
出現(xiàn)錯(cuò)誤Start operation timed out. Terminating.Failed to start openbsd secure shell server
,可以嘗試如下解決辦法
關(guān)閉由systemctl控制的ssh啟動(dòng)
systemctl stop ssh.service
刪除ssh的服務(wù)配置文件
rm /lib/systemd/system/ssh.service
重載systemctl
和ssh
服務(wù)文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-517360.html
systemctl daemon-reload
systemctl start ssh.service
祝大家好運(yùn)文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-517360.html
到了這里,關(guān)于Key exchange was not finished, connection is closed.解決辦法的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!