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 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

service sshd resstart 

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容