h2252947
Posts: 5
Joined: Fri May 18, 2018 2:47 am

SSH problems with Raspberry Pi Zero W

Fri May 18, 2018 2:49 am

Yesterday, I successfully SSH'ed into my RPI but today I can't seem to do it for some reason. I encounter a connection close at port 22. I reformatted my microSD card and reflashed raspbian lite onto it, tried methods online, which include adding the empty SSH file and adding the conf file to connect to my router. I can ping my pi, but an SSH attempt yields a Connection Reset by 192.168.1.5 port 22. A verbose SSH yields:

C:\Users\UserName>ssh -vvv pi@192.168.1.5

OpenSSH_for_Windows_7.6p1, LibreSSL 2.6.4

debug3: Failed to open file:C:\\Users\\UserName/.ssh/config error:2

debug3: Failed to open file:C:\\ProgramData\\ssh/ssh_config error:2

debug2: resolving "192.168.1.5" port 22

debug2: ssh_connect_direct: needpriv 0

debug1: Connecting to 192.168.1.5 [192.168.1.5] port 22.

debug1: Connection established.

debug1: identity file C:\\Users\\UserName/.ssh/id_rsa type 0

debug3: Failed to open file:C:\\Users\\UserName/.ssh/id_rsa-cert error:2

debug3: Failed to open file:C:\\Users\\UserName/.ssh/id_rsa-cert.pub error:2

debug1: key_load_public: No such file or directory

debug1: identity file C:\\Users\\UserName/.ssh/id_rsa-cert type -1

debug3: Failed to open file:C:\\Users\\UserName/.ssh/id_dsa error:2

debug3: Failed to open file:C:\\Users\\UserName/.ssh/id_dsa.pub error:2

debug1: key_load_public: No such file or directory

debug1: identity file C:\\Users\\UserName/.ssh/id_dsa type -1

debug3: Failed to open file:C:\\Users\\UserName/.ssh/id_dsa-cert error:2

debug3: Failed to open file:C:\\Users\\UserName/.ssh/id_dsa-cert.pub error:2

debug1: key_load_public: No such file or directory

debug1: identity file C:\\Users\\UserName/.ssh/id_dsa-cert type -1

debug3: Failed to open file:C:\\Users\\UserName/.ssh/id_ecdsa error:2

debug3: Failed to open file:C:\\Users\\UserName/.ssh/id_ecdsa.pub error:2

debug1: key_load_public: No such file or directory

debug1: identity file C:\\Users\\UserName/.ssh/id_ecdsa type -1

debug3: Failed to open file:C:\\Users\\UserName/.ssh/id_ecdsa-cert error:2

debug3: Failed to open file:C:\\Users\\UserName/.ssh/id_ecdsa-cert.pub error:2

debug1: key_load_public: No such file or directory

debug1: identity file C:\\Users\\UserName/.ssh/id_ecdsa-cert type -1

debug3: Failed to open file:C:\\Users\\UserName/.ssh/id_ed25519 error:2

debug3: Failed to open file:C:\\Users\\UserName/.ssh/id_ed25519.pub error:2

debug1: key_load_public: No such file or directory

debug1: identity file C:\\Users\\UserName/.ssh/id_ed25519 type -1

debug3: Failed to open file:C:\\Users\\UserName/.ssh/id_ed25519-cert error:2

debug3: Failed to open file:C:\\Users\\UserName/.ssh/id_ed25519-cert.pub error:2

debug1: key_load_public: No such file or directory

debug1: identity file C:\\Users\\UserName/.ssh/id_ed25519-cert type -1

debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.6

debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4p1 Raspbian-10+deb9u3

debug1: match: OpenSSH_7.4p1 Raspbian-10+deb9u3 pat OpenSSH* compat 0x04000000

debug2: fd 3 setting O_NONBLOCK

debug1: Authenticating to 192.168.1.5:22 as 'pi'

debug3: hostkeys_foreach: reading file "C:\\Users\\UserName/.ssh/known_hosts"

debug3: record_hostkey: found key type ECDSA in file C:\\Users\\UserName/.ssh/known_hosts:1

debug3: load_hostkeys: loaded 1 keys from 192.168.1.5

debug3: Failed to open file:C:\\Users\\UserName/.ssh/known_hosts2 error:2

debug3: Failed to open file:C:\\ProgramData\\ssh/ssh_known_hosts error:2

debug3: Failed to open file:C:\\ProgramData\\ssh/ssh_known_hosts2 error:2

debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521

debug3: send packet: type 20

debug1: SSH2_MSG_KEXINIT sent

Connection closed by 192.168.1.5 port 22

Any tips on how to proceed? Thanks.

User avatar
HawaiianPi
Posts: 2228
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: SSH problems with Raspberry Pi Zero W

Fri May 18, 2018 9:28 am

The majority of those errors seem to be failures of whatever SSH software you are using with Windows. Since you re-flashed Raspbian you may need to clear keys and configurations from your previous SSH session.

You could try PuTTY or WSL for SSH.
Last edited by HawaiianPi on Fri May 18, 2018 9:30 am, edited 1 time in total.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

User avatar
DougieLawson
Posts: 32339
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: SSH problems with Raspberry Pi Zero W

Fri May 18, 2018 9:29 am

How do you know that 192.168.1.5 is the address for your RPi? I'd guess it could be the address of your laptop from the collection of failures you've seen.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3B*3, 3B+

Please post ALL technical questions on the forum. Do not send private messages.

h2252947
Posts: 5
Joined: Fri May 18, 2018 2:47 am

Re: SSH problems with Raspberry Pi Zero W

Fri May 18, 2018 1:23 pm

DougieLawson wrote:
Fri May 18, 2018 9:29 am
How do you know that 192.168.1.5 is the address for your RPi? I'd guess it could be the address of your laptop from the collection of failures you've seen.
I used Nmap and found that this address correlates to my pi.

h2252947
Posts: 5
Joined: Fri May 18, 2018 2:47 am

Re: SSH problems with Raspberry Pi Zero W

Fri May 18, 2018 1:24 pm

HawaiianPi wrote:
Fri May 18, 2018 9:28 am
The majority of those errors seem to be failures of whatever SSH software you are using with Windows. Since you re-flashed Raspbian you may need to clear keys and configurations from your previous SSH session.

You could try PuTTY or WSL for SSH.
I SSHed from the windows cmd with admin privileges. I saw a few posts regarding clearing old SSh keys, but I can't figure out how to do it myself unfortunately.

User avatar
HawaiianPi
Posts: 2228
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: SSH problems with Raspberry Pi Zero W

Sat May 19, 2018 11:32 pm

h2252947 wrote:
Fri May 18, 2018 1:24 pm
I SSHed from the windows cmd with admin privileges. I saw a few posts regarding clearing old SSh keys, but I can't figure out how to do it myself unfortunately.
Did you install any SSH software, or are you using the new SSH functionality added recently with the Windows 10 spring update?
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

h2252947
Posts: 5
Joined: Fri May 18, 2018 2:47 am

Re: SSH problems with Raspberry Pi Zero W

Sat May 19, 2018 11:47 pm

HawaiianPi wrote:
Sat May 19, 2018 11:32 pm
h2252947 wrote:
Fri May 18, 2018 1:24 pm
I SSHed from the windows cmd with admin privileges. I saw a few posts regarding clearing old SSh keys, but I can't figure out how to do it myself unfortunately.
Did you install any SSH software, or are you using the new SSH functionality added recently with the Windows 10 spring update?
Yes, I'm using the Windows 10 openSSH from the cmd. I also tried to use PUTTY to access my pi but it doesn't work.

User avatar
HawaiianPi
Posts: 2228
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: SSH problems with Raspberry Pi Zero W

Sat May 19, 2018 11:59 pm

I *think* the OpenSSH keys are stored in your user folder in a folder named .ssh

C:\Users\yourusername\.ssh\known_hosts

If you delete the known_hosts file it should treat it as a new SSH session.

What happened when you tried PuTTY?
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

h2252947
Posts: 5
Joined: Fri May 18, 2018 2:47 am

Re: SSH problems with Raspberry Pi Zero W

Sun May 20, 2018 12:51 am

HawaiianPi wrote:
Sat May 19, 2018 11:59 pm
I *think* the OpenSSH keys are stored in your user folder in a folder named .ssh

C:\Users\yourusername\.ssh\known_hosts

If you delete the known_hosts file it should treat it as a new SSH session.

What happened when you tried PuTTY?
I deleted the known_hosts file and retried SSHing, it still gives me connection reset on port 22. Putty gives a Network error: Software caused connection abort error. Side note: the IP for the pi changed from 192.168.1.3 to 192.168.1.2. Is there a way to assign the pi a static IP?

User avatar
HawaiianPi
Posts: 2228
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: SSH problems with Raspberry Pi Zero W

Sun May 20, 2018 8:13 am

h2252947 wrote:
Sun May 20, 2018 12:51 am
Side note: the IP for the pi changed from 192.168.1.3 to 192.168.1.2. Is there a way to assign the pi a static IP?
Best way to do that is to reserve the I.P. in your router's DHCP settings. You assign the I.P. by MAC address, so your Pi0W will always get the same I.P. (even after an OS reinstall).
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

n67
Posts: 615
Joined: Mon Oct 30, 2017 4:55 pm

Re: SSH problems with Raspberry Pi Zero W

Sun May 20, 2018 9:46 am

Even better is to remove the requirement of static IP.

If things are setup correctly, you should be able to access the Pi as:

YourHostName.local

regardless of what its IP is.

User avatar
HawaiianPi
Posts: 2228
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: SSH problems with Raspberry Pi Zero W

Sun May 20, 2018 10:06 am

n67 wrote:
Sun May 20, 2018 9:46 am
Even better is to remove the requirement of static IP.

If things are setup correctly, you should be able to access the Pi as:

YourHostName.local

regardless of what its IP is.
True if you have a Zeroconf network service running (Apple's iTunes or Bonjour print service installs Zeroconf on Windows).

ssh pi@raspberrypi.local

Of course that also assumes all your Pi computers have unique hostnames (if you have more than one, and you haven't changed the default hostnames, then they're all raspberrypi).
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

Return to “Troubleshooting”

Who is online

Users browsing this forum: NotifedGaming and 8 guests