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-ed 到另一个树莓派的事实有关,但我不知道如何修复它以便我可以访问这个(并且可能重命名它以避免将来出现这个问题)。我试过做ssh-keygen -R raspberrypi.local,但我仍然收到相同的消息。我还需要做更多的事情来删除它吗?我也在使用在 Sierra 10.12.6 上运行的 mac。我尝试查看类似的问题,但找不到任何有效的方法。谢谢!

4

2 回答 2

29

我也有这个问题。

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

在本质上:

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

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

于 2017-11-24T22:36:01.767 回答
0

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

于 2017-10-30T03:10:17.667 回答