I have had a droplet for many months. Today I tried using the same SSH command in a Windows command prompt window that has worked in the past and I get:
ssh: connect to host droplet port 22: Connection refused
I can launch a Droplet Console from within DigitalOcean. The droplet is working and connects that way.
The following is the result of service ssh status
.
ssh.service - OpenBSD Secure Shell server Loaded: loaded (/usr/lib/systemd/system/ssh.service; disabled; preset: enabled) Active: active (running) since Sat 2024-10-05 23:40:15 UTC; 20s ago TriggeredBy: ● ssh.socket Docs: man:sshd(8) man:sshd_config(5) Process: 15739 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS) Main PID: 15742 (sshd) Tasks: 1 (limit: 2353) Memory: 1.2M (peak: 1.4M) CPU: 32ms CGroup: /system.slice/ssh.service └─15742 “sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups”
Oct 05 23:40:15 ubuntu-vanilla systemd[1]: Starting ssh.service - OpenBSD Secure Shell server… Oct 05 23:40:15 ubuntu-vanilla sshd[15742]: Server listening on :: port 22. Oct 05 23:40:15 ubuntu-vanilla systemd[1]: Started ssh.service - OpenBSD Secure Shell server.
I have read articles and documentation indicating that Ubuntu is using SSH differently but I do not understand what to do about that if that is the problem.
I am using 24.04.1 LTS
. The problem existed prior to a Linux version update and after the update.
How can I again use a Windows SSH command to log into the Droplet?
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!
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 determined that it is not a problem with the Droplet or DigitalOcean.
Heya,
Your ssh service is running fine given the details you’ve posted.
What I’ll recommend is to allow your IP address in your firewall. It seems like it that would be causing the issues. Another alternative would be to allow port 22 through your firewall however I would recommend just allowing your IP address.
Running the following command
where XXX.XXX.XXX.XXX is your own IP address should do the trick.
Hey Sam! 👋
It looks like your SSH service is running fine based on the
service ssh status
output, but the “Connection refused” error usually indicates that there might be some network-related issues or firewall rules preventing the connection.If you have a firewall like
ufw
enabled on your Droplet, it might be blocking port 22 (which is used for SSH). To check the current status ofufw
and allow SSH connections, run the following commands:If you see that port 22 is blocked, you can allow SSH by running:
If you’re using DigitalOcean Cloud Firewalls, make sure that SSH (port 22) is allowed for inbound connections. You can manage firewall rules from the DigitalOcean Control Panel.
If you don’t have a firewall, it’s also worth verifying that your SSH service is configured properly. Check the SSH configuration file:
Ensure the following lines are uncommented and properly set:
After making any changes, restart the SSH service:
Recently I had a chat with a user who had the same exact problem and in the end it turned out that they were using the wrong IP address. So I will recommend to make sure you’re using the correct IP address for your Droplet. Sometimes the public IP can change if the Droplet is restarted. You can verify the IP in the Droplets section of the DigitalOcean dashboard and make sure that you are using the public IP address!
Let me know how it goes! If you’re still running into issues, feel free to share any new error messages or logs.
- Bobby