How to Remove All Rules and Reset UFW Firewall
Resetting your Uncomplicated Firewall (UFW) can be a useful step for troubleshooting or starting fresh with your firewall rules. This guide will walk you through the process of resetting UFW and then re-enabling it with a basic SSH port open.
Resetting UFW
To reset UFW, type the following command:
ufw reset
This command will delete all existing firewall rules and disable the firewall.
Checking UFW Status
After resetting, if you check the status, you will find it is inactive. You can verify this with:
ufw status
Re-enabling Your Firewall
If you want to enable the firewall again, you'll typically want to allow SSH access first. To open port 22 (the standard SSH port), use the ufw allow
command:
ufw allow 22/tcp
Once you've allowed the necessary ports, you can start the firewall using the ufw enable
command:
ufw enable
That’s it! You’ve successfully reset UFW, removed all firewall rules, and re-enabled it.
In the next tutorial, we will learn how to open ports in UFW to allow specific services to communicate through the firewall.