gpt4 book ai didi

linux - 可以通过 putty 进行 SSH 但通过终端失败

转载 作者:太空宇宙 更新时间:2023-11-04 05:22:23 26 4
gpt4 key购买 nike

我一直在尝试使用 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

我还尝试使用此命令通过 Ubuntu 在 vagrant 中进行 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,重新生成 key ,但仍然给出相同的结果。有谁知道如何解决这个问题。这样我就可以通过终端或 PuTTY 访问我的服务器。

最佳答案

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

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

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

关于linux - 可以通过 putty 进行 SSH 但通过终端失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39761679/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com