Installing and using UFW on Ubuntu 18.04 LTS

Managing firewall using iptables is complicated. While iptables provides powerful functionality it’s syntax is often seen as complex. For most users a friendlier syntax can make managing your firewall much easier. UFW serves this purpose.

UFW stands for ‘uncomplicated firewall’. It is take as an alternative to the complicated iptables.

Most probably, your server will have UFW preinstalled.

To check whether it is installed or not run the command:

ufw --version

If it is installed, its version will be echoed. If application not found message will be echoed.

To install UFW in  Ubuntu Servers:

apt install ufw

To enable UFW:

ufw enable

How to Use UFW

If you’re unfamiliar with firewall management then UFW and this quick list will make things a breeze! It really is pretty simple to use since programs can provide support for UFW in the form of app profiles. Using these profiles you can easily allow/deny access for the specific application.

List all the profiles provided by installed packages:

ufw app list

When I ran the above command in my Virtual Machine, the following result echoed. This would mean I have installed this ‘profiles’ in the machine which require ports to be enabled.

Available applications:
  Apache
  Apache Full
  Apache Secure
  CUPS
  OpenSSH

For example, to allow access to Apache on both port 80 and 443:

ufw allow "Apache Full"

To see the status of ufw in your Ubuntu server:

ufw status verbose

NOTE: Based on the nature of user you are, you may need administrative accessibility to run the above commands. To do this add handy “sudo” in front of the above commands.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top