zoukankan      html  css  js  c++  java
  • openssh升级至7.2

    此处升级操作的原则是保留系统原有ssh服务,新安装高版本ssh服务

    1、下载openssh源码包

    http://www.openssh.com/portable.html

    2、安装
    #tar zxvf openssh-7.2p2.tar.gz
    #cd openssh-7.2p2
    #./configure --prefix=/usr/local/openssh --sysconfdir=/usr/local/openssh/etc --with-pam --with-ssl-dir=/usr/local/openssl --with-md5-passwords --mandir=/usr/share/man --with-zlib=/usr/local/zlib
    #make && make install
    3、配置启动脚本和配置文件
    cp /etc/init.d/sshd /ghca/bak/sshd #备份旧版sshd启动脚本
    cp /ghca/openssh-7.2p2/contrib/redhat/sshd.init /etc/init.d/sshd ##拷贝新版启动脚本
    vi /etc/init.d/sshd #编辑启动脚本

    主要将以下内容

    SSHD=/usr/sbin/sshd
    /usr/bin/ssh-keygen -A
    /sbin/restorecon /etc/ssh/ssh_host_key.pub
    /sbin/restorecon /etc/ssh/ssh_host_rsa_key.pub
    /sbin/restorecon /etc/ssh/ssh_host_dsa_key.pub
    /sbin/restorecon /etc/ssh/ssh_host_ecdsa_key.pub

    修改为:

    SSHD=/usr/local/openssh/sbin/sshd
    /usr/local/openssh/bin/ssh-keygen -A
    /sbin/restorecon /usr/local/openssh/etc/ssh_host_key.pub
    /sbin/restorecon /usr/local/openssh/etc/ssh_host_rsa_key.pub
    /sbin/restorecon /usr/local/openssh/etc/ssh_host_dsa_key.pub
    /sbin/restorecon /usr/local/openssh/etc/ssh_host_ecdsa_key.pub

    注意:此时/usr/local/openssh/etc目录下可能没有那几个key,但是也可以先这样修改,具体这个几个key的用法还没做研究。

    4、配置公私钥文件
    #cd /root/.ssh
    #/usr/local/openssh/bin/ssh-keygen -t rsa  #生成公私钥对
    #cat id_rsa.pub >> authorized_keys  #写入公钥到服务器认证文件
    5、将私钥文件下载保存至本地
    /root/.ssh/id_rsa
    6、重启sshd服务
    /etc/init.d/sshd restart
    7、配置本地SecureCRT并登录服务器
    将对应服务器登录session配置中去掉密码验证,并配置公钥路径,如下图:

     

    注意:openssh7.0以后就不允许root使用交互模式密码登录了,必须使用公钥登录,普通账号可以使用密码方式登录。

    * The default for the sshd_config(5) PermitRootLogin option has
       changed from "yes" to "prohibit-password".
     * PermitRootLogin=without-password/prohibit-password now bans all
       interactive authentication methods, allowing only public-key,
       hostbased and GSSAPI authentication (previously it permitted
       keyboard-interactive and password-less authentication if those
       were enabled).

    详见:http://bluereader.org/article/66465824?qqdrsign=07af0

  • 相关阅读:
    jQuery,from标签,歪路子小技巧
    UniApp随笔
    JS的一些操作
    文本环绕
    Dictionary 存储函数,方法
    GIT项目管理
    Vue2 学习记录
    VSCode + Vue 学习笔记
    Mysql,Insert,Select时自增长问题
    ASP.NET SignalR Troubeshooting
  • 原文地址:https://www.cnblogs.com/Before/p/5522560.html
Copyright © 2011-2022 走看看