Centos7升级OpenSSH

1、下载相关依赖包

# yum install -y gcc openssl-devel pam-devel rpm-build

2、 下载安装包

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

3、卸载原Openssh

[root@test ~]# rpm -qa |grep  openssh
openssh-7.4p1-16.el7.x86_64
openssh-clients-7.4p1-16.el7.x86_64
openssh-server-7.4p1-16.el7.x86_64

 

[root@test ~]# for i in $(rpm -qa |grep openssh);do rpm -e $i --nodeps;done

4、解压openssh安装包

tar -xvf openssh-7.9p1.tar.gz
[root@test openssh-7.9p1]#  cd openssh-7.9p1

5、编译安装

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

6、安装完成,执行配置

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

7、查看版本
[root@test openssh-7.9p1]# systemctl status sshd
● sshd.service - SYSV: OpenSSH server daemon
   Loaded: loaded (/etc/rc.d/init.d/sshd; bad; vendor preset: enabled)
   Active: active (running) since Fri 2018-11-16 20:01:38 CST; 3min 42s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 47313 ExecStart=/etc/rc.d/init.d/sshd start (code=exited, status=0/SUCCESS)
 Main PID: 47319 (sshd)
   CGroup: /system.slice/sshd.service
           └─47319 /usr/sbin/sshd

Nov 16 20:01:38 test systemd[1]: Starting SYSV: OpenSSH server daemon...
Nov 16 20:01:38 test sshd[47313]: Starting sshd:[  OK  ]
Nov 16 20:01:38 test systemd[1]: PID file /var/run/sshd.pid not readable (yet?) after start.
Nov 16 20:01:38 test sshd[47319]: Server listening on 0.0.0.0 port 22.
Nov 16 20:01:38 test sshd[47319]: Server listening on :: port 22.
Nov 16 20:01:38 test systemd[1]: Started SYSV: OpenSSH server daemon.


centos7 openssh升级脚本

rpm -qa |grep  openssh
for i in $(rpm -qa |grep openssh);do rpm -e $i --nodeps;done
tar -xvf openssh-7.9p1.tar.gz
cd openssh-7.9p1
 ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords--with-pam --with-tcp-wrappers  --with-ssl-dir=/usr/local/ssl --without-hardening
rm -rf /etc/ssh
make && make install
cp contrib/redhat/sshd.init /etc/init.d/sshd
chkconfig --add sshd
chkconfig sshd on
chkconfig --list|grep sshd
sed -i "32a PermitRootLogin yes" /etc/ssh/sshd_config
systemctl restart sshd
systemctl status sshd

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值