通过 {ssh 主机名} 端口 22 重置连接

Connection reset by {ssh hostname} port 22

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

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

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

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

我也遇到过这个问题

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

本质上:

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

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