Algorithm negotiation fail
使用java,sftp连接的时候,报出Algorithm negotiation fail 异常。
网上一搜,发现不少人有同样的问题,http://stackoverflow.com/questions/26424621/algorithm-negotiation-fail-ssh-in-jenkins,应该是ssh在6.7版本以后,对一些加密算法不支持,需要手动添加。在/etc/ssh/sshd_config最后添加一行加密算法,
Ciphers aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr,3des-cbc,arcfour128,arcfour256,arcfour,blowfish-cbc,cast128-cbc
MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,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
重启sshd,/etc/init.d/sshd restart,问题解决
遇到个sftp连接,代码报错的,用以上方法不行,同样修改和/usr/etc/sshd_config文件后,问题解决
本文介绍了解决SFTP连接中出现的Algorithm negotiation fail异常的方法。通过在sshd_config文件中手动指定加密算法、消息认证码及密钥交换算法,并重启SSH服务来修复问题。

被折叠的 条评论
为什么被折叠?



