重启后SSH冻结

时间:2018-01-18 09:37:26

标签: linux ssh raspberry-pi

我正在使用Raspberry Pi 3和Raspbian Stretch Lite。有时当我重新启动rpi时,我无法通过ssh登录。重启后有4种可能的情况:

  1. Connection refused始终出错。
  2. 输入密码后PuTTy挂起,不会产生任何错误。
  3. 我可以记录,但是在PuTTy中输入任何命令都没有响应。
  4. 连接PuTTy时只是黑屏,甚至没有密码提示。
  5. 我的/etc/ssh/sshd_config文件只删除了这些行:

    PermitRootLogin yes
    ChallengeResponseAuthentication no
    UsePAM yes
    X11Forwarding yes
    PrintMotd no
    AcceptEnv LANG LC_*
    Subsystem       sftp    /usr/lib/openssh/sftp-server
    

    编辑:ssh -v

    的输出
    ssh -v root@10.24.1.52
    OpenSSH_7.4p1 Raspbian-10+deb9u1, OpenSSL 1.0.2l  25 May 2017
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: /etc/ssh/ssh_config line 19: Applying options for *
    debug1: Connecting to 10.24.1.52 [10.24.1.52] port 22.
    debug1: Connection established.
    debug1: permanently_set_uid: 0/0
    debug1: key_load_public: No such file or directory
    debug1: identity file /root/.ssh/id_rsa type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /root/.ssh/id_rsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /root/.ssh/id_dsa type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /root/.ssh/id_dsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /root/.ssh/id_ecdsa type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /root/.ssh/id_ecdsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /root/.ssh/id_ed25519 type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /root/.ssh/id_ed25519-cert type -1
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-OpenSSH_7.4p1 Raspbian-10+deb9u1
    

1 个答案:

答案 0 :(得分:0)

您可以采取一些措施来调试问题。

  1. 在客户端使用详细模式(ssh -v / ssh -vv / ssh -vvv);你似乎已经运用了那个选项
  2. 检查服务器端的日志(Raspberry Pi),cat / var / log / auth
  3. 检查客户端(运行PuTTy的PC)和服务器(Raspberry Pi)之间的网络连接。有线/无线吗?是否有任何额外的网络设备,如路由器/防火墙?