JSchException: Algorithm negotiation fail

前端 未结 10 1902
面向向阳花
面向向阳花 2020-11-27 06:30

I am trying to connect to remote sftp server over ssh with JSch (0.1.44-1) but during \"session.connect();\" I am getting this exception:

com.jcraft.jsch.JS         


        
相关标签:
10条回答
  • 2020-11-27 06:52

    The complete steps to add the algorithms to the RECEIVING server (the one you are connecting to). I'm assuming this is a Linux server.

    sudo /etc/ssh/sshd_config
    

    Add this to the file (it can be at the end):

    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
    

    Then restart the SSH server:

    sudo service sshd restart
    
    0 讨论(0)
  • 2020-11-27 06:53

    Finally a solution that works without having to make any changes to the server:

    1. Download the latest jsch.jar as Yvan suggests: http://sourceforge.net/projects/jsch/files/jsch.jar/ jsch-0.1.52.jar works fine

    2. Place the downloaded file in your "...\JetBrains\PhpStorm 8.0.1\lib", and remove the existing jsch-file (for PHPStorm 8 it's jsch-0.1.50.jar)

    3. Restart PHPStorm and it should work

    Use the same solution for Webstorm

    0 讨论(0)
  • 2020-11-27 06:56

    The solution for me was to install the oracle unlimited JCE and install in JRE_HOME/lib/security. Then restarted glassfish and I was able to connect to my sftp server using jsch.

    0 讨论(0)
  • 2020-11-27 06:59

    Make sure that you're using the latest version of JSch. I had this exact same problem when using JSch 0.1.31 and trying to connect to a RedHat 5 server. Updating to the latest version solved the problem.

    0 讨论(0)
  • 2020-11-27 07:04

    I had the same issue, running Netbeans 8.0 on Windows, and JRE 1.7.

    I just installed JRE 1.8 from https://www.java.com/fr/download/ (note that it's called Version 8 but it's version 1.8 when you install it), and it fixed it.

    0 讨论(0)
  • 2020-11-27 07:05

    add KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha‌​1 to your sshd_config on the server.

    This worked, but make sure you restart sshd: sudo service sshd restart

    0 讨论(0)
提交回复
热议问题