CentOS升级OpenSSH 8.6p1

1. 下载tar包并安装依赖

shell> wget http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.6p1.tar.gz

shell> yum install -y gcc zlib-devel openssl-devel  pam-devel libselinux-devel 

shell> tar zxvf openssh-8.6p1.tar.gz

2.编译安装

shell> openssh-8.6p1/

shell> ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --with-zlib --with-tcp-wrappers --with-ssl-dir=/usr/local/ssl --without-hardening

shell> echo $?   #查看执行结果,如果为0,表示成功

shell> chmod 600 /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ed25519_key

shell> make && make install

shell> echo $?   #查看执行结果,如果为0,表示成功

shell> cp -f /etc/ssh/ssh_config

shell> cp -f /etc/ssh/sshd_config

shell> cp -a contrib/redhat/sshd.init  /etc/init.d/sshd

shell> cp -a contrib/redhat/sshd.pam /etc/pam.d/sshd.pam

shell> chmod u+x /etc/init.d/sshd

shell> mv /usr/lib/systemd/system/sshd.service /usr/lib/systemd/system/sshd.service.bak

3.修改配置文件

① 将 Port 22 取消注释修改为 65522		#自定义监听端口

② 在 PermitRootLogin prohibit-password 下添加一行 PermitRootLogin yes

4. 重载服务

shell> systemctl daemon-reload

shell> systemctl restart sshd

5. 验证版本

shell> ssh -V

OpenSSH_8.6p1, OpenSSL 1.0.2k-fips  26 Jan 2017
上一篇:OpenSSH升级


下一篇:Linux安装rpm包自动安装依赖