由{ssh hostname}端口22重置连接

时间:2017-10-29 22:19:48

标签: ssh raspberry-pi connection reset ssh-keygen

我正在尝试使用ssh pi@raspberrypi.local命令设置树莓派,但我不断收到这些消息:

ssh -v pi@raspberrypi.local 
OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 53: Applying options for *
debug1: Connecting to raspberrypi.local [2601:47:4001:d250:88ff:ddb5:f761:74d2] port 22.
debug1: Connection established.
debug1: identity file /Users/liz/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/liz/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/liz/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/liz/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/liz/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/liz/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/liz/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/liz/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4p1 Raspbian-10+deb9u1
debug1: match: OpenSSH_7.4p1 Raspbian-10+deb9u1 pat OpenSSH* compat 0x04000000
debug1: Authenticating to raspberrypi.local:22 as 'pi'
debug1: SSH2_MSG_KEXINIT sent
Connection reset by 2601:47:4001:d250:88ff:ddb5:f761:74d2 port 22

我有一种预感,它与我先前使用完全相同的主机名和用户名进入不同的覆盆子pi的事实有关,但我不知道如何修复它以便我可以访问这一个(并且可能将其重命名以避免将来出现此问题)。我尝试过ssh-keygen -R raspberrypi.local,但我仍然收到相同的消息。 还有更多我需要做的删除它吗?我也使用在Sierra 10.12.6上运行的mac。我尝试查看类似的问题,但找不到任何有效的方法。 谢谢!

2 个答案:

答案 0 :(得分:15)

我也有这个问题。

这是适用于我的解决方案: https://raspberrypi.stackexchange.com/a/60375/26923

本质上:

rm /etc/ssh/ssh_host_*
dpkg-reconfigure openssh-server

我认为问题在于首次启动时生成的密钥对文件已损坏(可能是在安装过程中插拔电源)。

答案 1 :(得分:0)

我最后通过自制软件安装dpkg,然后重新刷新SSD卡,然后就可以了。不确定为什么它是如此挑剔但有用的信息,以防其他人遇到类似的问题。