Skip to main content
Troubleshooting

Fix "UFW Status Inactive" in Ubuntu

UFW firewall showing inactive status in Ubuntu? Here's a simple solution for that.

Sagar Sharma

By default, the UFW firewall is not active on Ubuntu. When you try to check its status, it will show that your firewall is inactive.

$ sudo ufw status
Status: inactive

If you have disabled the firewall manually, it will show the same "status inactive" message.

How do you "fix" it? It's simple. You enable it.

sudo ufw enable

Let's see it in detail with examples and screenshots.

🚧
If you are accessing a remote server, checking the firewall rules before enabling it would be wise. Otherwise, a misconfigured server may block all incoming connections.

How to fix "UFW Status Inactive" in Ubuntu

You can fix this issue in three simple steps.

Trust me, it is going to be simple command execution and you will have your UFW firewall enabled in no time.

So let's start with the first step.

Step 1: Check the UFW Firewall status

First, you will have to check the status of the UFW firewall by using the following command:

sudo ufw status
check status of ufw firewall in ubuntu

And it will indicate that your firewall is not active.

Step 2: Enable UFW Firewall in Ubuntu

Once you find out that the firewall is not active, check if there are any rules added to it. This command will work even if the firewall is inactive.

sudo ufw show added

Check the rules and ensure that if you enable the firewall, things will be okay for you. And then enable the firewall.

sudo ufw enable
enable ufw firewall in ubuntu

And as you can see, the firewall is not active.

But for confirmation, checking its status is the best practice.

Step 3: Recheck UFW Firewall status

To check the status, you will be using the same old command that I used at the beginning of this guide:

sudo ufw status
recheck status of ufw firewall

Here you have it! The firewall has been activated successfully.

But just activating the firewall won't do any job.

By default, the UFW firewall will block incoming packets so you will have to allow every necessary service by yourself.

And for that purpose, we have a detailed guide:

Allow Ports Through UFW Firewall in Ubuntu
Learn how to open ports in Ubuntu and allow selected services through the firewall.

More on UFW...

Here's a quick summary of useful UFW commands.

Command Description
ufw status Check the status of the UFW firewall.
ufw enable Enable the UFW Firewall.
ufw allow < rule > Allow port/service through the UFW firewall.
ufw deny < rule > Drop the connection from a specific port/service on the UFW firewall.
ufw status verbose Get the detailed (verbose) status of the UFW firewall, which also includes logging levels.
ufw status numbered Shows UFW rules with numbers, which is helpful when you want to remove rules.
ufw reject < rule > Reject connection from specific port or service.
ufw logging < logging_level > Change the logging level of the UFW firewall.
ufw delete <rule/number> Delete the UFW firewall rule.
ufw reload Reload the UFW firewall.
ufw disable Disable the UFW firewall.

If you want, you can download the above table in PDF format for quick reference in the future.

I also recommend reading about logging in UFW a little. This will help you troubleshoot firewall-related issues.

How to Check Firewall Logs in Ubuntu
Checking the firewall logs can tell you about the critical details for network security. Here’s how to check UFW firewall logs in Ubuntu.

I hope you will find this guide helpful and if you have any queries, let me know in the comments.

Sagar Sharma