3

I am trying to connect with sftp server from client machine. But com.jcraft.jsch.JSchException: Algorithm negotiation fail this kind of error i am getting.

com.jcraft.jsch.JSchException: Algorithm negotiation fail
    at com.jcraft.jsch.Session.receive_kexinit(Session.java:540)
    at com.jcraft.jsch.Session.connect(Session.java:288)
    at com.jcraft.jsch.Session.connect(Session.java:145)
    at com.na.common.NewReading.main(NewReading.java:28)

i have tried to resolve this by using Algorithm negotiation fail SSH in Jenkins and i have changed the KexAlgorithms in sshd_config, but getting the error.

So please help me. Thank you

Community
  • 1
  • 1
vashista vasi
  • 41
  • 1
  • 6
  • Does this answer your question? [JSch Algorithm negotiation fail](https://stackoverflow.com/questions/30846076/jsch-algorithm-negotiation-fail) – Prasad Jadhav Nov 27 '22 at 17:37

1 Answers1

5

In my case - OpenSSH_6.7p1 on server - I had to modify KexAlgorithms and MACs (additional hmac-md5,hmac-sha1,hmac-sha1-96,hmac-md5-96 values):

KexAlgorithms curve25519-sha256@libssh.org,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 hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com,hmac-md5,hmac-sha1,hmac-sha1-96,hmac-md5-96

Above should be put placed:

/etc/ssh/sshd_config

And then restart the ssh:

sudo /etc/init.d/ssh restart
wierzbiks
  • 1,148
  • 10
  • 10
  • It would suffice to add `aes128-cbc` to the `ciphers` and `hmac-sha2-256` to the `macs` and left other default values in sshd_config unchanged. – Homaei Jun 07 '20 at 08:12