Centos7升级OpenSSH

#注意安装升级openssh时需要关闭SELinux,否则退出后无法登陆
临时关闭:setenforce 0
永久关闭:sed -i ‘s/enforcing/disabled/g’ /etc/sysconfig/selinux

1、下载相关依赖包

[root@localhost ~]# yum install -y gcc openssl-devel pam-devel rpm-build

2、下载安装包

[root@localhost ~]# wget http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.1p1.tar.gz

3、卸载原Openssh

[root@localhost ~]# rpm -qa |grep  openssh
openssh-clients-7.4p1-16.el7.x86_64
openssh-7.4p1-16.el7.x86_64
openssh-server-7.4p1-16.el7.x86_64
[root@localhost ~]# for i in $(rpm -qa |grep openssh);do rpm -e $i --nodeps;done

4、解压openssh安装包,并进入

[root@localhost ~]# tar -zxvf openssh-8.1p1.tar.gz
[root@localhost ~]# cd openssh-8.1p1

5、编译安装

[root@localhost openssh-8.1p1]# ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords--with-pam --with-tcp-wrappers  --with-ssl-dir=/usr/local/ssl --without-hardening
[root@localhost openssh-8.1p1]# rm -rf /etc/ssh
[root@localhost openssh-8.1p1]# make && make install

6、安装完成,执行配置

[root@localhost openssh-8.1p1]# cp contrib/redhat/sshd.init /etc/init.d/sshd
[root@localhost openssh-8.1p1]# chkconfig --add sshd
[root@localhost openssh-8.1p1]# chkconfig sshd on
[root@localhost openssh-8.1p1]# chkconfig --list|grep sshd
[root@localhost openssh-8.1p1]# sed -i "32a PermitRootLogin yes" /etc/ssh/sshd_config
[root@localhost openssh-8.1p1]# systemctl restart sshd

7、查看版本

[root@ocalhost openssh-8.1p1]# ssh -V
OpenSSH_8.1p1, OpenSSL 1.0.2k-fips  26 Jan 2020
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值