Question
port 22: Connection refused
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.
×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.
sudo netstat -plutndo you see an instance of openssh/a program listening on port 22 there?
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?
@kamaln7 , I can’t connect to my IP address using my browser (so somehow similar problem). I ran the command and here’s what happened:
sudo netstat -plutn | grep 22
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1706/sshd
tcp6 0 0 :::22 :::* LISTEN 1706/sshd
Could you please help me figure out what the problem is?
Thanks!
Hi @emisaghi, that command is checking for processes that are listening on port 22, which is used for SSH access. Browsers use port 80 for HTTP by default, so I would start by checking if you have a webserver installed and running that is listening on that.
If you’ve installed a webserver already, simply run the same command as mentioned before, replacing the 22
with 80
and see if you get any results.
If you don’t know whether or not you’ve installed a webserver (e.g. Apache or nginx), can you tell me more about what image you have built your Droplet from and what you have installed on it?
Thanks for your prompt response. I actually had the server listening to port 80, too and it was a 1-click WordPress 4.6.1 on Ubuntu 16.04. Unfortunately, because of all the trouble, I had to destroy the droplet and create a new one. The new one works, but I haven’t configured Varnish or swap on it, yet. I’ll try those and see if any of the steps in those is actually causing the problem.
Thanks again!
Sounds good. I hope it goes well :) But if you run into any issues, please don’t hesitate to post a question!
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!