操作系统CentOS Linux release 7.9.2009 (Core)
从OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017 升级到9.1 版本
操作系统CentOS release 6.7 (Final)
从 OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013 升级到9.1 版本
提示升级前最好多开几个ssh连接,以防连接中断,连接不上ssh
下载
wget http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.1p1.tar.gz
cp -rf /etc/ssh /etc/ssh.bak
ssh -V
yum install -y gcc openssl-devel pam-devel rpm-build pam-devel
tar -zxvf openssh-9.1p1.tar.gz
cd openssh-9.1p1/
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-zlib --with-md5-passwords --with-tcp-wrappers
echo $?
make && make install
cat /etc/ssh/sshd_config|grep RootLogin
vi /etc/ssh/sshd_config
根据提示, 注释掉下面三行。注意提示有可能不同,主要是注释GSSAPI相关的内容
/etc/ssh/sshd_config line 93: Unsupported option GSSAPIAuthentication
/etc/ssh/sshd_config line 94: Unsupported option GSSAPICleanupCredentials
/etc/ssh/sshd_config line 123: Deprecated option UsePrivilegeSeparation
根据提示有可能用到下面的命令(centos6 版本可能用不到,centos7 可能用到)
chmod 0600 /etc/ssh/ssh_host_ed25519_key
chmod 0600 /etc/ssh/ssh_host_rsa_key
chmod 0600 /etc/ssh/ssh_host_ecdsa_key
编辑/etc/ssh/sshd_config,将ClientAliveInterval设置为300到900,即5-15分钟,将ClientAliveCountMax设置为0-3之间。
ClientAliveInterval 900
ClientAliveCountMax 3
service sshd restart
service sshd status
ssh -V
ps -ax | grep ssh