SSH version upgrade causes connection failure

The company's system uses the third-party ssh plug-in jsch-0.1.39.jar. The collection was normal before, but the manufacturer's server ssh was upgraded to version 2.0, and then the program reported an error. The exception is as follows:

com.jcraft.jsch.JSchException: Algorithm negotiation fail
        at com.jcraft.jsch.Session.receive_kexinit(Session.java:510)
        at com.jcraft.jsch.Session.connect(Session.java:285)
        at com.jcraft.jsch.Session.connect(Session.java:149)
        at ...........

After searching on the Internet, most of them said that it was caused by the inconsistent encryption methods between the client and the server after the version upgrade. The solution is to modify the /etc/ssh/sshd_config or /usr/etc/sshd_config file and add the following content:
 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,[email protected]

However, the server belongs to the manufacturer and it is not easy for them to modify it. This method is passed.

Later, a colleague said that he had encountered this before and it would be fine if he upgraded the plug-in. So he decisively downloaded the latest version of jsch-0.1.53.jar, and after replacing it, everything was fine.

If you don’t understand the underlying things, just take notes.

Guess you like

Origin blog.csdn.net/u013456765/article/details/52192812