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

  • 相关阅读:
    mysql索引创建&查看&删除
    linq中不能准确按拼音排序
    Vue的组件的注册,复用以及组件中template多行处理
    Vue的简单使用和部分常用指令
    SpringBootMVC+thymeleaf模板初探
    记一次遗留代码的重构改造:数十万行国家标准坐标文件分析方法的改造与提速
    springBoot 集成Mysql数据库
    C#和Java的对比
    架构学习提炼笔记(三):高性能架构设计技巧——读写分离
    架构学习提炼笔记(二):架构设计的流程是什么?
  • 原文地址:https://www.cnblogs.com/jzhg/p/8984412.html
Copyright © 2011-2022 走看看