Connection reset by {ssh hostname} port 22
Asked Answered
C

2

12

I'm trying to set up a raspberry pi with the command ssh [email protected] but I keep getting these messages:

ssh -v [email protected] 
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

I have a hunch that it has something to do with the fact that I previously ssh-ed into a different raspberry pi with the exact same hostname and username, but I don't know how to fix it so that I can access this one (and probably rename it to avoid this problem in the future). I tried doing ssh-keygen -R raspberrypi.local but I'm still getting the same messages. Is there more I need to do to remove it? I'm also using a mac running on Sierra 10.12.6. I tried looking through similar issues but couldn't find anything that worked. Thanks!

Chercherbourg answered 29/10, 2017 at 22:19 Comment(4)
Is it possible that the two devices are also trying to use the same IP address?Ancell
That could be, although the first pi has been offline the entire time I've been trying to connect. Would I need to reroute it or reconfigure it somehow?Chercherbourg
Never mind then. It would only be an issue if both were on the network with the same IP at the same timeAncell
Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See What topics can I ask about here in the Help Center. Perhaps Super User or Unix & Linux Stack Exchange would be a better place to ask.Blotter
L
29

I had this problem too.

Here's the solution that worked for me: https://raspberrypi.stackexchange.com/a/60375/26923

In essence:

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

I believe the problem is that the keypair files that are generated on first boot were corrupt (perhaps from plugging and unplugging power during the setup process).

Lunik answered 24/11, 2017 at 22:36 Comment(2)
Expanding the partition via raspi-config. Then enabling ssh. I knew better. But I wanted to see, since it gave no warning (other than a reset was necessary... might not have read past that).Palatine
Worked for me. Thanks!Mcmullin
C
0

I ended up installing dpkg via homebrew, and re-flashing the SSD card and then it worked. Not really sure why it was so finicky but helpful information in case anyone else runs into a similar issue.

Chercherbourg answered 30/10, 2017 at 3:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.