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

12

我正试图使用命令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

我有一种直觉,这可能与我之前使用相同的主机名和用户名通过ssh登录到不同的树莓派有关,但我不知道该如何解决它,以便我可以访问这个(并且可能将其重命名以避免今后出现此问题)。 我尝试了ssh-keygen -R raspberrypi.local,但我仍然收到相同的消息。是否还需要做更多来删除它?我也在运行Sierra 10.12.6的Mac上。我尝试查看类似的问题,但找不到有效的解决方案。谢谢!


这两个设备是否有可能尝试使用相同的IP地址? - that other guy
可能是这样,尽管我一直在尝试连接的时候第一个树莓派都处于离线状态。我需要重新路由或重新配置它吗? - liz
那就算了。只有在它们同时使用相同的IP地址时才会出现问题。 - that other guy
1
Stack Overflow是一个关于编程和开发问题的网站。这个问题似乎不属于编程或开发范畴。请参阅帮助中心中的我可以在这里问什么样的问题。也许超级用户Unix&Linux Stack Exchange更适合提问。 - jww
2个回答

29

我也遇到了这个问题。

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

本质上:

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

我认为问题在于第一次启动时生成的密钥对文件已经损坏了(可能是在设置过程中插拔电源导致的)。


通过raspi-config扩展分区,然后启用ssh。我知道这样做不太好,但我想看看,因为它没有任何警告(除了需要重置...可能没有读过那个)。 - TamusJRoyce
对我有用。谢谢! - Merkle Groot

0

最终我通过Homebrew安装了dpkg,重新刷写了SSD卡,然后它就正常工作了。不太确定为什么会这么棘手,但如果其他人遇到类似的问题,这些信息可能会有所帮助。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接