port 22: Connection refused

December 4, 2013 15.5k views
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 :/
16 Answers
Turns out I was using a VPN that blocked port 22. Now everything is working properly.
You tried other SSH clients? Alternatively, check using nmap-if port 22 is not used by any service or firewall.
Are you trying to connect after a fresh install? Or, perhaps, is there a firewall deployed or the SSH port got changed?
@max: Do you have a firewall installed on your droplet? Can you log in using the remote console?
I'm having the exact same issue. I can log in using the Console but can't ssh in from terminal or via SFTP. I didn't intentionally install a firewall on my droplet. How would I check for that? This is a new droplet created from a snapshot image.
I took a snapshot and then tried to launch a larger droplet and now I'm locked out of both.

I'm getting: ssh: connect to host port 22: Connection refused
@ajb: Try logging into your droplet using the remote console and running
sudo netstat -plutn
do you see an instance of openssh/a program listening on port 22 there?
Hello same issue on fresh dropplet image installations
Same issue here. Created a fresh droplet choosing Wordpress on Ubuntu 13.10 as the droplet type. Tried 'ssh' and recieving ssh: connect to host port 22: Connection refused
as the error.

Is that port blocked on default installation?

Having same problem, anyone found the solution?

  • Is it based on an Application image? If so, try waiting a few minutes before trying to connect while the droplet is being configured. If not, try logging into your droplet using the Remote Console and running sudo netstat -plutn | grep 22, does it output a line with "sshd" in it?

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.

  • so what should I do if my port is 2500 what should I change in my ssh command?

It seems that Droplets by default listen at 2200 for the ssh
use 2200 instead 22

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....

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.

Have another answer? Share your knowledge.