The default Ubuntu firewall is ufw, with is short for “uncomplicated firewall.” Ufw is a frontend for the typical Linux iptables commands, but it is developed in such a way that basic firewall tasks can be performed without the knowledge of iptables.
Additionally, ufw can be managed from a graphical interface. In this tutorial, you will learn how to enable and disable firewall on Ubuntu 20.04 LTS Focal Fossa Linux from both command line and GUI.
In this tutorial you will learn:
- How to check firewall status
- How to enable/disable firewall
- How to control firewall settings from GUI
Software Requirements and Conventions Used
|Category||Requirements, Conventions or Software Version Used|
|System||Installed or upgraded Ubuntu 20.04 Focal Fossa|
|Other||Privileged access to your Linux system as root or via the
|Conventions||# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
How to enable/disable firewall on Ubuntu 20.04 LTS Focal Fossa Linux step by step instructions
- The first thing we should do is check the status of the firewall to see if it’s on or off.
$ sudo ufw status Status: active
As seen here, our firewall is currently active (on). For more detailed output regarding your current firewall settings, add the
$ sudo ufw status verbose
- To disable the Ubuntu firewall, execute the following command.
$ sudo ufw disable
- If you decide you need to enable the Ubuntu firewall again later, you can run the following command.
Please note that by enabling your firewall you may get disconnected if you are currently using SSH to remotely connect to your Ubuntu server.
$ sudo ufw enable
Enable or Disable Ubuntu firewall via GUI
To control ufw via GUI, you need to install the
gufw package with the following command.
$ sudo apt install gufw
Then, start the gufw application and click on the Status switch to either enable or disable the firewall. See the video below for more help.
In this tutorial, you learned how to enable or disable the system firewall (ufw) in Ubuntu 20.04. You also saw how to check the current status of the firewall. Normally, you will not need to disable the firewall unless for testing purposes or something similar. If you need to allow a port through the firewall, see our tutorial on how to Open/Allow incoming firewall port on Ubuntu 20.04.