最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
JSch连接SSH问题Exception:Algorithm negotiation fail
时间:2022-11-14 23:25:46 编辑:袖梨 来源:一聚教程网
使用Jenkins配置完远程SSH服务器,发生无法连接问题,查看Log后找到
[SSH] Exception:Algorithm negotiation fail
com.jcraft.jsch.JSchException: Algorithm negotiation fail
at com.jcraft.jsch.Session.receive_kexinit(Session.java:520)
at com.jcraft.jsch.Session.connect(Session.java:286)
at com.jcraft.jsch.Session.connect(Session.java:150)
at org.jvnet.hudson.plugins.SSHSite.createSession(SSHSite.java:141)
at org.jvnet.hudson.plugins.SSHSite.executeCommand(SSHSite.java:151)
at org.jvnet.hudson.plugins.SSHBuildWrapper.executePreBuildScript(SSHBuildWrapper.java:75)
at org.jvnet.hudson.plugins.SSHBuildWrapper.setUp(SSHBuildWrapper.java:59)
at hudson.model.Build$BuildExecution.doRun(Build.java:154)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:533)
at hudson.model.Run.execute(Run.java:1754)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
Finished: FAILURE
原因分析:
OpenSSH和 JSch支持的交换算法不同,需要一方打开另一方支持的交换算法。
OpenSSH enables only the following key exchange algorithms by default:
- [email protected]
- ecdh-sha2-nistp256
- ecdh-sha2-nistp384
- ecdh-sha2-nistp521
- diffie-hellman-group-exchange-sha256
- diffie-hellman-group14-sha1
Where as JSch claims to support these algorithms for key exchange:
- diffie-hellman-group-exchange-sha1
- diffie-hellman-group1-sha1
解决办法:
在SSH的配置文件
/etc/ssh/sshd_config
增加以下两行,让SSH支持相应的算法和MACs
KexAlgorithms [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
MACs [email protected],[email protected],[email protected],[email protected],hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,[email protected],hmac-md5,hmac-sha1,hmac-sha1-96,hmac-md5-96
完成后重启SSH即可解决问题
相关文章
- 《潜行者2:切尔诺贝利之心》借刀杀人成就攻略分享 11-21
- 《潜行者2:切尔诺贝利之心》游戏保存方法介绍 11-21
- 《潜行者2:切尔诺贝利之心》游戏支线任务作用介绍 11-21
- 《潜行者2:切尔诺贝利之心》异常现象特点介绍 11-21
- 《潜行者2:切尔诺贝利之心》随机事件避免原因介绍 11-21
- 《潜行者2:切尔诺贝利之心》随机事件应对方法推荐 11-21