How to disable ufw so I can ssh back into my droplet?

I’ve access to a droplet. Then I’ve installed ufw and left all the ports disallowed. Now I can’t ssh back into the machine.

How to disable the ufw?


Submit an 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.

Hello @paxprajapati

You can access the droplet via the DigitalOcean console from your account and then disable UFW from there.

The Droplet console provides out-of-band access and is available regardless of your network settings. It emulates the access you would have if you were sitting down with a keyboard and monitor attached to the actual server. You can use this feature to log in and revert bad settings to regain normal access.

You can check this article - How to Regain Access to Droplets using the DigitalOcean Droplet Console

If you decide you don’t want to use UFW, you can disable it with this command:

  1. sudo ufw disable

Any rules that you created with UFW will no longer be active. You can always run sudo ufw enable if you need to activate it later.

If you already have UFW rules configured but you decide that you want to start over, you can use the reset command:

  1. sudo ufw reset

Hope that this helps! Regards, Alex