How to configure the Uncomplicated firewall in Ubuntu
Every Operating system should have a firewall enabled and configured correctly. However a lot of people don’t perform this action on a Linux Operating System. Maybe its because they are unsure, or don’t know how to properly configure one. However, one of the important reasons to having a firewall is ensuring there is no unwanted traffic or people looking at our machines, a firewall will generally block everything unless explicitly told to allow something in.
If you are looking to achieve Cyber Essentials and are running Linux, you should also have this configured.
In this article we’re looking at how we can install, turn on and configure a firewall, we’ll go through several steps to show how to do this. If you don’t want to read this though, we also have a quick video which goes through the same steps on our YouTube Channel, which you can find here: https://youtu.be/41aS6vXJe2Q
Before we get started, we should start by saying, although nothing should go wrong with these commands, please ensure that your computer is backed up before carrying out these actions.
One of the first things you should do when you look to install some software, is checking to make sure your computer is updated, this can be performed by the following commands:
sudo apt update -y sudo apt upgrade -y
Once your Operating System is up to date, you then need to install the Uncomplicated firewall, or ufw.
sudo apt install ufw -y
To allow the default rules to be applied on the firewall, deny all inbound and allow recommended outbound connections, you run the commands:
sudo ufw default allow outgoing sudo ufw default deny incoming
If you are running Linux, you’l likely want SSH access to your machine as well, for this, you can run the command:
sudo ufw allow SSH
To turn on the firewall, you can run the command:
sudo ufw enable
To turn the firewall off you can run the command
sudo ufw disable
You can check the status of the firewall to see if it is running or not by running the command:
sudo ufw status
To delete a firewall rule, you can run the list firewall rule command, by running:
sudo ufw status numbered
Then, find the number of the rule and issue the command:
sudo ufw delete <number>
Theres a lot more you can do with the Uncomplicated firewall product on Ubuntu and Linux, so check out more resources and see what you can do.