Seazzy
Posts: 1
Joined: Sun Nov 20, 2016 10:36 pm

Port 22 connection refused (SSH)

Sun Nov 20, 2016 10:44 pm

When trying to SSH in to a computer that's connected to the same wifi network, I get connection refused, although I can ping the IP address. This problem has repeated itself on two different wifi networks, and both connection attempts were made from separate Mac laptops.

I've tried renewing DHCP on both machines, and there don't appear to be any IP tables rules with block connections. SSH is enabled in RasPiConfig.

when $ ssh local host
ssh: connect to host localhost port 22: connection refused

I am running Pixel on a RPi3. Any help from people who have experienced this problem (and solved it?) would be much appreciated!

mfa298
Posts: 1386
Joined: Tue Apr 22, 2014 11:18 am

Re: Port 22 connection refused (SSH)

Mon Nov 21, 2016 2:56 pm

Seazzy wrote:When trying to SSH in to a computer that's connected to the same wifi network, I get connection refused, although I can ping the IP address. This problem has repeated itself on two different wifi networks, and both connection attempts were made from separate Mac laptops.

I've tried renewing DHCP on both machines, and there don't appear to be any IP tables rules with block connections. SSH is enabled in RasPiConfig.

when $ ssh local host
ssh: connect to host localhost port 22: connection refused

I am running Pixel on a RPi3. Any help from people who have experienced this problem (and solved it?) would be much appreciated!
Have you checked that the Pi your trying to SSH into is actually up and running ?

Are you sure you're trying to ssh to the correct IP address for the Pi ?

Are you running the 'ssh localhost' command on your mac or one of the Pi's you're tring to connect to. Localhost is a special name that means this device, so if you run that on the mac you're trying to ssh into the mac not a Pi.

notholmen
Posts: 31
Joined: Tue Dec 25, 2012 10:10 am

Re: Port 22 connection refused (SSH)

Mon Nov 21, 2016 5:29 pm

Just to be sure, try this:

Code: Select all

sudo apt install openssh-server
That should install and or fix any issues with the SSH server (if any from an installation perspective)

Return to “Troubleshooting”