Report this

What is the reason for this report?

Unable to SSH into my DigitalOcean Droplet after changing UFW and DNS settings

Posted on October 12, 2025

Hi everyone,

I’ve been facing a really frustrating issue with my Droplet over the past couple of days and could really use some help or suggestions.

I have a small web app hosted on a DigitalOcean Droplet (Ubuntu 22.04). Everything was running perfectly fine — I could SSH into it, deploy code, and manage things smoothly. But recently, I made two changes:

  1. I enabled and configured ufw to tighten the firewall rules.

  2. I updated my domain’s DNS records (pointing to the same Droplet IP).

Right after making those changes, I suddenly lost the ability to connect to my Droplet via SSH. When I try to connect using:

 ssh root@<my-droplet-ip>

the terminal just hangs for a while and then throws a “Connection timed out” error. I’ve already double-checked that port 22 is allowed in ufw (it shows as open when I check from the console). I even tried disabling ufw temporarily from the DigitalOcean Recovery Console, but SSH still doesn’t connect.

I also checked the networking tab on the DigitalOcean dashboard to confirm the Droplet’s public IP and everything seems fine there. Ping works fine too, but SSH refuses to connect.

Could this be related to DNS propagation or something else I might have missed in my firewall setup? Or is there a chance the SSH service itself isn’t running correctly?

I’d really appreciate any advice on how to troubleshoot this safely without risking data loss. If anyone has gone through a similar issue or knows a step-by-step way to fix it (like using the Recovery Console or rebuilding SSH access), I’d love to hear your suggestions.

Thanks in advance!



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.

Hi Ben,

This doesn’t sound like a DNS issue, since SSH connects directly to the IP address. It’s more likely that something in the firewall rules or SSH configuration is blocking the connection.

From the Recovery Console, check that the SSH service is running with systemctl status ssh, and verify your firewall settings with sudo ufw status verbose, port 22 should be allowed. You can also confirm that SSH is listening properly by running sudo netstat -plant | grep 22 or sudo ss -tlnp | grep ssh.

Feel free to share the output of the commands here!

Heya, @benner

Since you’re using the IP address of the droplet to connect, it seems to be a UFW-related problem. You can temporarily disable the UFW to check if the SSH access will be restored.

You can do so with the following command:

sudo ufw disable

Once the firewall is disabled, try connecting again using an SSH client, and if successful, you can inspect your UFW rules.

Regards

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.