Failed to connect and initialize SSH connection in Jenkins

180 views Asked by At

After Updating Jenkins from Java 1.8.x.x to 1.11.x.x & updating Jenkins LTS version from 2.3xx.x to 2.4xx.x, Updated all Plugins as in Manage plugins recommandations.

Post-build Actions "Send build artifacts over SSH" failed. Also Test Connection from Manage Jenkins Page Failed as below

"Failed to connect or change directory"

jenkins.plugins.publish_over.BapPublisherException: Failed to connect and initialize SSH connection. Message: [Failed to connect session for config [hostname]. Message [Algorithm negotiation fail: algorithmName="server_host_key" jschProposal="ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256" serverProposal="ssh-rsa,ssh-dss"]]

Downgrading Java or Jenkins LTS is not an option for us, as the other Dependencies Passed.

Tried lowering the SSH Plugins and Jsch Plugin. which failed due to the other Dependency Plugin failed to Load.

Some Connections to the Servers are working good and Some are Failing, as servers are both Old and New combinations. do not want to fallback on reverting. enter image description here

1

There are 1 answers

0
Raghav Tallam On

New latest Jsch plugin has an Updated Jar file which is having issues connecting to some secured servers.

Latest jar file is "jsch-0.2.16.jar". try copying another jar file along with the current Jar file. in my Case, I used both "jsch-0.2.16.jar" & "jsch-0.1.55.jar" in the "%JENKINS_HOME%\plugins\jsch\WEB-INF\lib\

This resolved the Connection issue.

enter image description here