Tag Archives: ssh com.jcraft.jsch.JSchException: Algorithm negotiation fail

[Solved] ssh com.jcraft.jsch.JSchException: Algorithm negotiation fail

Our automatic installation and deployment tool ideploy, using ssh to connect to the host and deploy the business. Today, after providing to the first-line installation planning, the installation reported an error and the test connection to the host failed, while it is possible to connect to the host directly using ssh. Check the problem error stack as follows.

[plain]
view plain
copy

ERRORpool-4-thread-12015-06-1514:28:59,852[SSHTerminal](connectToServer:275)Thesshisconnectexception.Try1times.

com.jcraft.jsch.JSchException:Algorithmnegotiationfail

atcom.jcraft.jsch.Session.receive_kexinit(Session.java:520)

atcom.jcraft.jsch.Session.connect(Session.java:286)

atcom.huawei.breeze.ideploy.terminal.SSHTerminal.connectToServer(SSHTerminal.java:236)

atcom.huawei.breeze.ideploy.terminal.SSHTerminal.connect(SSHTerminal.java:151)

atcom.huawei.breeze.ideploy.terminal.SSHTerminal.checkConnect(SSHTerminal.java:105)

atcom.huawei.breeze.ideploy.terminal.UnixTerminal.executeNormal(UnixTerminal.java:950)

atcom.huawei.breeze.ideploy.terminal.UnixTerminal.executeForward(UnixTerminal.java:812)

atcom.huawei.breeze.ideploy.terminal.UnixTerminal.executeNormal(UnixTerminal.java:884)

atcom.huawei.breeze.ideploy.terminal.Terminal.execute(Terminal.java:195)

atcom.huawei.breeze.ideploy.host.HostCheckRunner.run(HostCheckRunner.java:84)

atjava.util.concurrent.ThreadPoolExecutor.runWorker(UnknownSource)

atjava.util.concurrent.ThreadPoolExecutor$Worker.run(UnknownSource)

atjava.lang.Thread.run(UnknownSource)

It should be that ssh does not support some encryption algorithms after version 6.7 and needs to be added manually. The result of checking the ssh version of the single board in question is as follows.

[plain]
view plain
copy

user01@caiyun-aas02:~>ssh-V

OpenSSH_6.8p1,OpenSSL0.9.8j-fips07Jan2009

A properly running host is then as follows.

[plain]
view plain
copy

user01@caiyun-ndmc-db01:/>ssh-V

OpenSSH_6.2p2,OpenSSL0.9.8j-fips07Jan2009

Problem solved: add a line of encryption algorithm at the end of /etc/ssh/sshd_config, restart sshd, /etc/init.d/sshd restart, problem solved

2015-7-28, added, encountered a sftp connection, the code reported an error, using the above method does not work, the same modification and /usr/etc/sshd_config file, the problem is solved, record it.