CentOS升级OpenSSH 8.6p1

本文详细介绍了如何下载并安装OpenSSH 8.6p1,包括编译、配置、定制端口和权限,以及修改启动脚本。步骤包括yum安装依赖、源码编译、配置参数设置、服务重载和版本验证。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值