zoukankan      html  css  js  c++  java
  • Centos7 openssh7.9p1安装

    先安装telnet,以防安装ssh出现问题,无法远程登录设备。

    最新版openssh下载地址:http://www.openssh.com/ftp.html

    一、安装telnet和xinetd:

    1、安装telnet和xinetd

    systemctl stop firewalld #安装完不要忘了开启防火墙
    
    rpm -qa | grep telnet
    yum -y install telnet telnet-server
    systemctl enable telnet.socket
    systemctl start  telnet.socket
    
    rpm -qa | grep xinetd
    yum -y install xinetd
    systemctl enable xinetd.service
    systemctl start xinetd

    2、连接测试:(远程连接)

    telnet  ip地址

    二、安装openssh7.9p1:

    1、卸载旧版本:

    rpm -qa | grep openssh|xargs rpm -e --nodeps

    2、解压编译安装:
    #下载

    wget https://openbsd.hk/pub/OpenBSD/OpenSSH/portable/openssh-7.9p1.tar.gz

    #解压编译(存在报错的话,参见“三、编译安装报错集合”)

    tar -zxf openssh-7.9p1.tar.gz
    cd openssh-7.9p1
    ./configure --prefix=/usr --sysconfdir=/etc/ssh
    make && make install

    3、修改配置:

    vim /etc/ssh/sshd_config
    PermitRootLogin no

    4、添加服务/启动服务:

    cp openssh-7.9p1/contrib/redhat/sshd.init /etc/init.d/sshd
    chkconfig --add sshd
    systemctl daemon-reload
    systemctl start sshd

    5、检查版本信息:

    # ssh -V
    OpenSSH_7.9p1, OpenSSL 1.0.2k-fips  26 Jan 2017

    6、卸载telnet:

    rpm -qa | grep telnet |xargs rpm -e --nodeps

    三、编译安装报错集合:

    1、./configure --prefix=/usr --sysconfdir=/etc/ssh 报错汇总
    【报错1】

    configure: error: *** zlib.h missing - please install first or check config.log ***

    解决方法:

    # yum install -y zlib-devel

    【报错2】

    configure: error: *** OpenSSL headers missing - please install firstorcheck config.log
    或者
    configure: error: *** OpenSSL headers missing - please install first or check config.log ***

    解决方法:

    # yum -y install openssl-devel


    2、make install报错:
    【报错】

    ssh-keygen: generating new host keys: DSA
    /usr/sbin/sshd -t -f /etc/ssh/sshd_config
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    Permissions 0640 for '/etc/ssh/ssh_host_rsa_key' are too open.
    It is required that your private key files are NOT accessible by others.
    This private key will be ignored.
    Error loading host key "/etc/ssh/ssh_host_rsa_key": bad permissions
    Could not load host key: /etc/ssh/ssh_host_rsa_key
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    Permissions 0640 for '/etc/ssh/ssh_host_ecdsa_key' are too open.
    It is required that your private key files are NOT accessible by others.
    This private key will be ignored.
    Error loading host key "/etc/ssh/ssh_host_ecdsa_key": bad permissions
    Could not load host key: /etc/ssh/ssh_host_ecdsa_key
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    Permissions 0640 for '/etc/ssh/ssh_host_ed25519_key' are too open.
    It is required that your private key files are NOT accessible by others.
    This private key will be ignored.
    Error loading host key "/etc/ssh/ssh_host_ed25519_key": bad permissions
    Could not load host key: /etc/ssh/ssh_host_ed25519_key
    sshd: no hostkeys available -- exiting.
    make: [check-config] Error 1 (ignored)

    解决方法:

    # rm -rf /etc/ssh/ssh_host_*
    # make install

    参照:
    https://www.cnblogs.com/lixuwu/p/6102444.html
    https://blog.csdn.net/qq_38693296/article/details/85698554

  • 相关阅读:
    JS offset
    CSS 实现大小写切换
    CSS 选择器的优先级
    JS DOM hasChildNodes的用法
    HTML fieldset和legend标签
    JS this的用法
    js基础之DOM中元素对象的属性方法
    php windows环境 安装 Apache-apollo + phpMQTT 实现发送 MQTT
    php 执行exec() 操作linux 命令
    linux office转换pdf
  • 原文地址:https://www.cnblogs.com/pzzning/p/10698662.html
Copyright © 2011-2022 走看看