zoukankan      html  css  js  c++  java
  • RedHat 7.0更新升级openSSH7.4p1

    由于目前服务器上ssh版本较低,存在安全漏洞,需要升级到最新版本。

    系统版本:RedHat 7.0

    openSSH版本:6.4p1

    openSSH版本:7.4p1

    升级方式:源码安装

    安装操作步骤如下:

    1、更新ssl

    #yum update openssl  

    2、备份ssh目录

    #cp -rf /etc/ssh /etc/ssh.bak  

    注:安装telnet,以备ssh更新失败无法远程连接,如果可以现场操作可忽略

    3、安装升级所需组件

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

    4、解压升级包,并安装

    tar -zxvf openssh-7.4p1.tar.gz   
    cd openssh-7.4p1  
    ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-zlib --with-md5-passwords   
    make && make install  

    或者yum源安装

    #yum -y install openssh openssh-clients openssh-server

    需要安装客户端和服务端、启动服务端和设置下开机启动。

    5、修改配置文件

    vim /etc/ssh/sshd_config  

    1)、修改PermitRootLogin

    #PermitRootLogin yes
    修改为
    PermitRootLogin yes

    2)、注释掉下面的新版本不支持的配置

    #GSSAPIAuthentication yes

    #GSSAPICleanupCredentials yes

    编辑脚本ssh_chmod.sh并执行(这是执行查看状态发现权限不对进行相应的修改,可根据情况自行设置)

    #!/bin/bash
    cd /etc/ssh
    chmod 600 ssh_host_rsa_key
    chmod 640 ssh_host_ed25519_key
    chown -R root:ssh_keys ssh_host_ed25519_key
    chmod 600 ssh_host_ecdsa_key
    

     

    6、重启SSH

    #systemctl restart sshd

    7、查看SSH状态

    #systemctl status sshd

    如需提前卸载旧版,可按照下述步骤操作

    1、查看旧版openSSH

    #rpm -qa | grep openssh 

    2、卸载旧版openSSH

    #rpm -e `rpm -qa | grep openssh` --nodeps  

    注:

    1、在configure openssh时,如果有参数 –with-pam,会提示:“PAM is enabled. You may need to install a PAM control file for sshd, otherwise password authentication may fail. Example PAM control files can be found in the contrib/ subdirectory”提示文字,

    就是如果启用PAM,需要有一个控制文件,按照提示的路径找到redhat/sshd.pam,并复制到/etc/pam.d/sshd,在/etc/ssh/sshd_config中打开UsePAM yes。发现连接服务器被拒绝,关掉就可以登录

    https://blog.csdn.net/mayifan0/article/details/73293419

  • 相关阅读:
    BZOJ2219数论之神——BSGS+中国剩余定理+原根与指标+欧拉定理+exgcd
    Luogu 3690 Link Cut Tree
    CF1009F Dominant Indices
    CF600E Lomsat gelral
    bzoj 4303 数列
    CF1114F Please, another Queries on Array?
    CF1114B Yet Another Array Partitioning Task
    bzoj 1858 序列操作
    bzoj 4852 炸弹攻击
    bzoj 3564 信号增幅仪
  • 原文地址:https://www.cnblogs.com/jzhg/p/8984412.html
Copyright © 2011-2022 走看看