【问题标题】:Can SSH via putty but fail via terminal可以通过 putty SSH 但通过终端失败
【发布时间】:2017-02-07 06:29:31
【问题描述】:

我一直在尝试使用 ssh 访问我的树莓派服务器。在 Windows 7 中,我使用的是 cygwin。这里是我使用的命令。

ssh pi@10.34.8.56 -v

结果在这里

OpenSSH_7.3p1, OpenSSL 1.0.2h  3 May 2016
debug1: Connecting to 10.34.8.56 [10.34.8.56] port 22.
debug1: Connection established.
debug1: identity file /home/Maswari/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Maswari/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Maswari/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Maswari/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Maswari/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Maswari/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Maswari/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Maswari/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.7p1 Raspbian-5+deb8u3
debug1: match: OpenSSH_6.7p1 Raspbian-5+deb8u3 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 10.34.8.56:22 as 'pi'
debug1: SSH2_MSG_KEXINIT sent
Connection reset by 10.34.8.56 port 22

我也尝试使用这个命令在 vagrant 中通过 Ubuntu 进行 ssh

ssh pi@10.34.8.56 -v

结果是

OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 10.34.8.56 [10.34.8.56] port 22.
debug1: Connection established.
debug1: identity file /home/vagrant/.ssh/id_rsa type 1
debug1: identity file /home/vagrant/.ssh/id_rsa-cert type -1
debug1: identity file /home/vagrant/.ssh/id_dsa type -1
debug1: identity file /home/vagrant/.ssh/id_dsa-cert type -1
debug1: identity file /home/vagrant/.ssh/id_ecdsa type -1
debug1: identity file /home/vagrant/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/vagrant/.ssh/id_ed25519 type -1
debug1: identity file /home/vagrant/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.7p1 Raspbian-5+deb8u3
debug1: match: OpenSSH_6.7p1 Raspbian-5+deb8u3 pat OpenSSH* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
Connection closed by 10.34.8.56

但不知何故,当我尝试使用 PuTTY 进行连接时,一切都很好。我可以访问我的服务器。我查找 ssh 日志并给我特定的结果

sshd[6553]: fatal: Read from socket failed: Connection reset by peer [preauth]
sshd[6823]: fatal: Read from socket failed: Connection reset by peer [preauth]
sshd[6934]: Accepted password for pi from 172.19.0.5 port 51395 ssh2
sshd[6934]: pam_unix(sshd:session): session opened for user pi by (uid=0)

来自 Cygwin 和终端的 SSH 似乎会产生此错误

sshd[6553]: fatal: Read from socket failed: Connection reset by peer [preauth]

我已经在服务器中重新安装了 ssh,重新生成了密钥,但仍然给出了相同的结果。有谁知道如何解决这个问题。所以我可以通过终端或 PuTTY 访问我的服务器。

【问题讨论】:

    标签: linux ssh terminal cygwin putty


    【解决方案1】:

    sshd[6553]:致命:从套接字读取失败:对等方重置连接 [预授权]

    这意味着生成了一个 ssh 密钥,只有拥有该密钥的人才能访问它。要解决这个问题...

    sudo apt-get purge openssh-server
    

    然后

    sudo apt-get autoremove
    

    最后一个

    sudo apt-get install openssh-server 
    

    那就试试吧

    ssh -i deployment_key.txt demo@192.237.248.66
    

    【讨论】:

      猜你喜欢
      • 2015-03-03
      • 2023-03-11
      • 2012-05-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-05
      相关资源
      最近更新 更多