Question

port 22: Connection refused

  • Posted December 4, 2013

I was trying to log in my server through Mac Terminal. I typed ‘ssh root@ipaddress’ and it gives me ‘ssh: connect to host ipaddress port 22: Connection refused’. how should I log in? I just forgot :/

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I have solved this issue by unchecking the SSH key.

I have set an ssh key for the previous droplet. When I try to use the same ssh key for the new droplet it refused me to connect on port 22. I destroyed and created a new droplet and did not choose the ssh key. When I got the e-mail for the password it worked using that password.

I have solved this issue by unchecking the SSH key.

I have set an ssh key for the previous droplet. When I try to use the same ssh key for the new droplet it refused me to connect on port 22. I destroyed and created a new droplet and did not choose the ssh key. When I got the e-mail for the password it worked using that password.

I Had the same issue, but with the sudo netstat -plutn | grep 22 i realized that my real port was changed to 2500, and not 22 anymore. but now it’s working properly.

Turns out I was using a VPN that blocked port 22. Now everything is working properly.

Hi, <br>You tried other SSH clients? Alternatively, check using nmap-if port 22 is not used by any service or firewall.

Hi, <br>You tried other SSH clients? Alternatively, check using nmap-if port 22 is not used by any service or firewall.

I was getting Connection refused after I typed in the wrong password in ssh. After I logged in successfully from the Digital Ocean Console, I was able to log in successfully with ssh.

For ubuntu 16 this worked for me

from the console

$ sudo service sshd restart

Did anyone find the answer? I’m still stuck with this issue for several months now and it’s a real pain. I can’t access my filezilla anymore even though I used to!

When I did sudo netstat -plutn | grep 22 from the console, it gave me the following

tcp        0      127.0.0.1:5432            0.0.0.0:*       LISTEN   1064/postgres
tcp        0      127.0.0.1:25            0.0.0.0:*       LISTEN      1291/master
tcp        0      127.0.0.1:3306            0.0.0.0:*       LISTEN      1019/mysqld
tcp        0      0 0.0.0.0:22            0.0.0.0:*       LISTEN      1706/sshd
tcp6        0      0::::00            0.0.0.0:*       LISTEN      1364/apache2
tcp6        0      0:::1:25            0.0.0.0:*       LISTEN      1291/master

Thank you all so much!

I’m having the exact same problem since a letsencrypt certificate expired not connection to port 22 what do I do as I cannot access via console either…