Algorithm negotiation fail 解决办法(jsch)

1.打印 jsch KEX algorithms 和host key algorithms

System.out.println("JSch.getConfig(\"kex\"):"+JSch.getConfig("kex"));  
        System.out.println("JSch.getConfig(\"server_host_key\"):"+JSch.getConfig("server_host_key"));

2.响应如下:

 JSch.getConfig("kex"):ecdh-sha2-nistp256
ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
JSch.getConfig("server_host_key"):
ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521

3.进入liunx 中,将上面打印出来的值,通过命令   sudo vi sshd_config

修改到KexAlgorithms 和HostKeyAlgorithms

你可能感兴趣的:(java,jvm,eclipse)