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
    
  • 相关阅读:
    SQL Server 2005 Integration Services (SSIS)数据源之MySQL
    SQL Server 2005 Integration Services (SSIS)数据源之Sybase
    oracle10g 监听服务无法启动
    创建一个People类型,有年龄、工资、性别三个属性。 定义一个方法叫做找对象,找对象方法传过来一个人;
    基于组件的C#农历算法
    ASP.NET中实现中文简/繁体自动转换的类
    最牛的QQ资料
    单一登陆(Single Signon)问题
    Smart Client Case Study Source Code Download from MSDN China
    简历制作 | 论文资源 | 考试认证 | 招聘求职 | 文学艺术 | 外语学习
  • 原文地址:https://www.cnblogs.com/nihaorz/p/12068856.html
Copyright © 2011-2022 走看看