系统环境:
[root@localhost]# cat /etc/centos-release
CentOS release 6.4 (Final)
[root@localhost]# sshd -V
unknown option -- V
OpenSSH_6.7p1, OpenSSL 1.0.0-fips 29 Mar 2010
服务器以前升级过openssl/openssh
安装openssl和openssh
[root@localhost ~]# pwd
/root
[root@localhost ~]# tar zxvf openssl-1.0.2u.tar.gz
[root@localhost ~]# cd openssl-1.0.2u
[root@localhost openssl-1.0.2u]# make
[root@localhost openssl-1.0.2u]# make test
[root@localhost openssl-1.0.2u]# make install
[root@localhost openssl-1.0.2u]# echo "/usr/local/openssl-1.0.2u/lib" >> /etc/ld.so.conf[root@localhost openssl-1.0.2u]# /sbin/ldconfig -v[root@localhost openssl-1.0.2u# /usr/local/openssl*/bin/openssl version -a
OpenSSL 1.0.2u 20 Dec 2019
built on: reproducible build, date unspecified
platform: linux-x86_64
options: bn(64,64) rc4(16x,int) des(idx,cisc,16,int) idea(int) blowfish(idx)
compiler: gcc -I. -I.. -I../include -fPIC -DOPENSSL_PIC -DZLIB_SHARED -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -m64 -DL_ENDIAN -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM
OPENSSLDIR: "/usr/local/openssl-1.0.2u/ssl"[root@localhost ~]# tar zxvf openssh-9.2p1.tar.gz
[root@localhost ~]# cd openssh*
[root@localhost openssh-9.2p1]#./configure --prefix=/usr/local/openssh-9.2p1 --with-ssl-dir=/usr/local/openssl-1.0.2u/ --with-pam --with-zlib
[root@localhost openssh-9.2p1]#make && make install
[root@localhost openssh-9.2p1]# /usr/local/openssh-9.2p1/sbin/sshd -V
OpenSSH_9.2, OpenSSL 1.0.2u 20 Dec 2019
注意: 安装openssl时,make test会出错,把时间改为20230101,就可以通过。然后再改回来
#date MMDDhhmm[[CC]YY][.ss]例如,将系统时间设置为2023年1月1日,1点1分,可以使用:
#date 010101012023#再改回20240703 11:05
#date 070311052024
修改配置
停止sshd服务,删除sshd启动配置
#service sshd stop
#chkconfig --del sshd进入ssh安装解压目录
#cp ./contrib/redhat/sshd.init /etc/init.d/sshd9.2
(/etc/init.d 实际链接 /etc/rc.d/init.d)修改启动文件
#vi /etc/rc.d/init.d/sshd9.2
...
# Some functions to make the below more readable
#SSHD=/usr/sbin/sshd
#PID_FILE=/var/run/sshd.pid
SSHD=/usr/local/openssh-9.2p1/sbin/sshd
PID_File=/var/run/sshd9_2.pid
...添加启动
#chkconfig --add sshd9.2
#service sshd9.2 start