Linux系统上升级OPENSSH

升级openssh
安装包地址:https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/
1.安装zlib
tar xf zlib-1.3.1.tar.gz
cd zlib-1.3.1
./configure --prefix=/usr/local/zlib
make && make install
2.升级openssl
tar xf openssl-3.0.0.tar.gz
cd openssl-3.0.0
./config --prefix=/usr/local/openssl shared zlib #一定要加上shared 参数,要不在安装openssh的时候就无法找到,最好指定安装路径,不然找不到安装好的openssl在哪
make && make install

#备份原来的openssl
mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl /usr/include/openssl.bak
#因为源码安装默认安装的位置是 /usr/local/ssl 需要将创建软链接到系统位置
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/ssl/include/openssl /usr/include/openssl
#将openssl 的lib 库添加到系统
echo “/usr/local/ssl/lib” > /etc/ld.so.conf.d/openssl.conf
#使新添加的lib 被系统找到
ldconfig
#查看openssl版本
openssl version -a

3.升级openssh
#备份原openssh文件

mv /etc/init.d/ssh /etc/init.d/ssh.old
cp -r /etc/ssh /etc/ssh.old

#开始安装对应版本的openssh

tar xf openssh-8.7.tar.gz
cd openssh 8.7
	./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --with-zlib --with-ssl-dir=/usr/local/ssl --with-privsep-path=/var/lib/sshd #需要指定openssl的安装路径
或者./configure --prefix=/usr --sysconfdir=/etc/ssh --with-zlib --with-md5-passwords --with-pam
make && make install

#可查看当前SSH的版本。
ssh -V
sshd -V
到目前所有升级就已经完成了

下面进行还原ssh配置
cd /etc/ssh
mv sshd_config sshd_config.default
cp …/ssh.old/sshd_config ./
#使用原来的/etc/init.d/ssh
mv /etc/init.d/ssh.old /etc/init.d/ssh
#取消注销指定服务
systemctl unmask ssh
#重启服务
systemctl restart sshd

  • 6
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值