sftp JSch 登录报错

com.jcraft.jsch.JSchException: Algorithm negotiation fail

        at com.jcraft.jsch.Session.receive_kexinit(Session.java:520)

        at com.jcraft.jsch.Session.connect(Session.java:286)

        at com.jcraft.jsch.Session.connect(Session.java:150)

        at com.mcloud.utils.SFTPUtils.uploadStream(SFTPUtils.java:64)

        at com.mcloud.spark.MultiCloudBill.copyFileToSFTP(MultiCloudBill.java:416)

        at com.mcloud.spark.MultiCloudBill.main(MultiCloudBill.java:94)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

解决:

在目的机器上 sudo /etc/ssh/sshd_config 添加 加密解密算法 

KexAlgorithms [email protected],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

service sshd resstart 

你可能感兴趣的:(sftp JSch 登录报错)