【问题标题】:com.jcraft.jsch.JSchException: Algorithm negotiation failcom.jcraft.jsch.JSchException:算法协商失败
【发布时间】:2016-09-07 21:45:39
【问题描述】:

我正在尝试从客户端机器连接 sftp 服务器。但是 com.jcraft.jsch.JSchException: Algorithm协商失败了我得到的这种错误。

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)

我已尝试使用Algorithm negotiation fail SSH in Jenkins 解决此问题,并且我已更改 sshd_config 中的 KexAlgorithms,但出现错误。

所以请帮助我。谢谢

【问题讨论】:

    标签: algorithm


    【解决方案1】:

    就我而言 - 服务器上的 OpenSSH_6.7p1 - 我必须修改 KexAlgorithms 和 MAC(附加 hmac-md5、hmac-sha1、hmac-sha1-96、hmac-md5-96 值):

    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
    

    上面应该放:

    /etc/ssh/sshd_config
    

    然后重启ssh:

    sudo /etc/init.d/ssh restart
    

    【讨论】:

    • 将aes128-cbc 添加到ciphers 和hmac-sha2-256 到macs 就足够了,并且sshd_config 中的其他默认值保持不变。
    猜你喜欢
    • 2018-08-07
    • 1970-01-01
    • 2021-12-25
    • 1970-01-01
    • 2018-04-14
    • 2017-02-12
    • 2015-04-21
    相关资源
    最近更新 更多