Question

port 22: Connection refused

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 :/


Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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.

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

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.