UFW (Uncomplicated Firewall) is a simple and easy-to-use firewall for Ubuntu and other Linux distributions. It allows you to manage the incoming and outgoing network traffic on your system. By default, UFW is not active on Ubuntu, which means that it will show the status “inactive” when you check it with the command
<code>sudo ufw status</code>
However, this does not mean that your system is unprotected from the internet. You can still access the internet through other ports or protocols that are not blocked by UFW. Therefore, it is recommended to enable UFW on your system for security reasons.
In this article, we will show you how to fix UFW status inactive on Ubuntu and how to enable it permanently.
How to Check UFW Status
Before we proceed, let’s check the current status of UFW on your system. To do that, open a terminal window and type the following command:
<code>sudo ufw status</code>
You should see something like this:
Status: inactive
To Action From
-- ------ ----
22/tcp ALLOW Anywhere
80/tcp ALLOW Anywhere
443/tcp ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)
80/tcp (v6) ALLOW Anywhere (v6)
443/tcp (v6) ALLOW Anywhere (v6)
As you can see, the status is “inactive”, which means that UFW is not enabled or configured properly.
How to Enable UFW
The first thing we need to do is to enable UFW on our system. To do that, type the following command in the terminal:
<code>sudo ufw enable</code>
You should see something like this:
Status: active
To Action From
-- ------ ----
22/tcp ALLOW Anywhere
80/tcp ALLOW Anywhere
443/tcp ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)
80/tcp (v6) ALLOW Anywhere (v6)
443/tcp (v6) ALLOW Anywhere (v6)
Now, you can see that the status has changed from “inactive” to “active”, which means that UFW is enabled and ready to use.
How to Enable UFW Permanently
By default, UFW will only be enabled temporarily when you run the command
<code>sudo ufw enable</code>
This means that if you reboot your system or log out of your session, UFW will be disabled again.
If you want to make sure that UFW stays enabled even after rebooting or logging out, you need to configure it permanently. To do that, follow these steps:
- Open a terminal window and type
sudo nano /etc/ufw/ufw.conf
. This will open a text editor where you can edit the configuration file of UFW. - In the text editor, scroll down until you find a line that says
#DefaultDeny = yes
. This line disables all firewall rules by default. - Change
#DefaultDeny = yes
toDefaultDeny = no
. This will enable all firewall rules by default. - Save and close the text editor by pressing Ctrl+O and then Ctrl+X.
- Exit the text editor by typing
exit
or pressing Ctrl+D. - Restart your system or log out of your session.
Now, when you check the status of UFW with the command sudo ufw status
, you should see something like this:
Status: active
To Action From
-- ------ ----
22/tcp ALLOW Anywhere
80/tcp ALLOW Anywhere
443/tcp ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)
80/tcp (v6) ALLOW Anywhere (v6)
443/tcp (v6) ALLOW Anywhere (v6)
You have successfully fixed UFW status inactive on Ubuntu and enabled it permanently.
Conclusion
In this article, we have shown you how to fix UFW status inactive on Ubuntu and how to enable it permanently. By doing so, you can protect your system from unwanted network traffic and access from outside sources.
We hope you found this article helpful and informative. If you have any questions or feedback, please feel free to leave a comment below. Thank you for reading!