Connect to Raspberry Pi over ssh: connection refused (from putty)
I have a raspberry running raspbian, and I want to connect over SSH, but something is happening.
On the raspberry I have run nmap and port 22 says: OPEN; the ssh process is running and fine.
But I can't connect from my windows 8.1 machine with putty, I just get connection refused.
Can anyone give me any pointers?
Edit: forgot to mention that I can both ping it and I have checked raspi-config, and it seems normal.
I had some trouble resolving dependencies with apt-get, but I reinstalled resolvconf, and that fixed it.
EDIT2: It also didn't work while disabling the Windows Firewall.
EDIT3: I can ssh the pi from the pi.
EDIT4: I just found out that my raspberry and windows box have the same ip... what?
Sure it is connected to the internet? Try in the command line following command : `ifconfig wlan0` . Is there a _real_ IP adress in the line `inet addr`?
Check if the ssh starts in boot from '/etc/init/' and check 'sudo raspi-config', you might have disabled ssh
I had a similar issue...finally just restarted my router (after losing 1.5 hrs debugging), and boom, magically it all works again! Symptoms were weird: all devices had internet, but could not talk to each other, and SSH refused. Restarting router fixed whatever the issue was...so it turns out it wasn't even on the PCs.
So, I figured it out.
A long time ago I assigned an IP to my pi on the router, binding its mac address to the IP.
It so happened yesterday that I had the same IP when I needed the pi again. So I probably tried to connect to my windows machine from my windows machine because of the identical IP's.
What fixed it was this in cmd (on my windows box):
Raspberry changed something since November 2016
here is the noob instruction to get this problem fixed
sudo su raspi-config
1) Choose first 'update'
2) In advanced options -> expand_root file system
3) interfacing options -> ssh [enable]
4) change_locale [your country-UTF8] and if you still here, it's good to change the timezone as well
5) change the default password (don't be lazy, just do it :)
Please - add "change default user password" to the above list. This is probably the reason they turned it off by defaut.
It might be an issue with wrong SSH key pair matching. Your client stores SSH keys of previous sessions. So if you've SSH'ed in the past with this same client to another device (or same Raspberry but with different build) on the same IP, the keys on both sides don't match. Solution: delete the keys on your client.
Putty stores SSH keys in the registry:
HKEY_CURRENT_USER\SoftWare\YOU\PuTTY\SshHostKeys. If you aren't using Putty have a look at
%USERPROFILE%\.ssh. If you're using OSX, have a look at
It might be the windows firewall that is blocking the outbound ssh connection. Make sure port 22 is allowed out of your windows machine.
And for kicks `ifconfig` on the Pi and `ipconfig` on windows show that both systems are on the same network?