zoukankan      html  css  js  c++  java
  • sshd_config已修改,ssh还是无法远程问题解决

    环境:vmware下的debian10.2

    /etc/sshd/sshd_config 配置文件已经完成修改开启允许root账号登录配置

    ssh远程返回如下信息:

    [Administrator.NIHAORZ-WORK-PC] ➤ ssh root@192.168.36.135
    Connection reset by 192.168.36.135 port 22
    

    通过vmware进入虚拟机查看服务状态返回:

    debian:~# systemctl status sshd
    ● ssh.service - OpenBSD Secure Shell server
       Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
       Active: active (running) since Thu 2019-12-19 08:57:57 UTC; 14s ago
         Docs: man:sshd(8)
               man:sshd_config(5)
      Process: 850 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
     Main PID: 851 (sshd)
        Tasks: 7 (limit: 9511)
       Memory: 7.6M
       CGroup: /system.slice/ssh.service
               ├─786 sshd: root@pts/0
               ├─788 sshd: root@notty
               ├─790 /usr/lib/openssh/sftp-server
               ├─792 -bash
               ├─851 /usr/sbin/sshd -D
               ├─856 systemctl status sshd
               └─857 pager
    
    Dec 19 08:57:57 debian systemd[1]: ssh.service: Found left-over process 848 (systemctl) in control group while starting unit. Ignoring.
    Dec 19 08:57:57 debian systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
    Dec 19 08:57:57 debian systemd[1]: ssh.service: Found left-over process 849 (systemd-tty-ask) in control group while starting unit. Ignoring.
    Dec 19 08:57:57 debian systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
    Dec 19 08:57:57 debian sshd[851]: Could not load host key: /etc/ssh/ssh_host_rsa_key
    Dec 19 08:57:57 debian sshd[851]: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
    Dec 19 08:57:57 debian sshd[851]: Could not load host key: /etc/ssh/ssh_host_ed25519_key
    Dec 19 08:57:57 debian sshd[851]: Server listening on 0.0.0.0 port 22.
    Dec 19 08:57:57 debian systemd[1]: Started OpenBSD Secure Shell server.
    Dec 19 08:57:57 debian sshd[851]: Server listening on :: port 22.
    
    

    显示缺失ssh_host_rsa_keyssh_host_ecdsa_keyssh_host_ed25519_key三个文件

    执行如下三条命令创建密钥文件:

    ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
    ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key
    ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key
    

    再依次执行服务重启和服务状态查看命令,确认服务启动正常则尝试再次ssh远程

    systemctl restart sshd
    systemctl status sshd
    
  • 相关阅读:
    KISSY 1.3.0 发布,淘宝 Web UI 库
    mongodb的监控与性能优化
    Aspose.Tasks 4.9.0 发布,Project 文件读写
    Fix8 0.6.6 发布,C++ 实现的 FIX 框架
    VIM Pal 1.1.0 发布,VIM 文件树列表
    QT 5.0 正式版发布,支持 C++11
    TWiki 5.1.3 发布,企业 Wiki 系统
    Apache Lucene 3.6.2 发布
    Apache Sqoop 1.99.1 发布
    JAXX 2.5.9 发布,XML用户界面框架
  • 原文地址:https://www.cnblogs.com/nihaorz/p/12068856.html
Copyright © 2011-2022 走看看