port 22: Connection refused

Posted December 4, 2013 81.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 :/

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.

Submit an Answer
19 answers

For ubuntu 16 this worked for me

from the console

$ sudo service sshd restart

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

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.

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

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.

Are you trying to connect after a fresh install? Or, perhaps, is there a firewall deployed or the SSH port got changed?
Same thing here, fresh install, snapshot
@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.
Previous 1 2 Next