ssh版本升级后ssh或者sftp连接失败的处理方法

一、问题描述

原来的ssh版本是5.3,

ssh -V

OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010

升级以后的版本是7.4

OpenSSH_7.4p1, OpenSSL 1.0.1u 22 Sep 2016

升级以后服务器原来的代码都连接不上sftp,出现Algorithm negotiation fail SSH in Jenkins等问题,用python写了一个paramiko的测试程序也出现问题,可以确认是安全级别的问题

二、解决办法

vi /etc/ssh/sshd_config,在文件尾加入下面的配置:

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





版权声明:本文为yfhuang12原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。