UFW (Uncomplicated Firewall) provides a straightforward interface for managing firewall rules on Ubuntu. By default, Ubuntu ships with UFW installed but disabled, leaving systems without active firewall protection until you explicitly enable it. Whether you’re securing a desktop workstation or hardening a server, understanding how to enable, disable, and verify UFW status is essential for maintaining network security.
This guide covers checking UFW status, enabling the firewall with proper SSH precautions for remote servers, disabling when needed for troubleshooting, and installing GUFW for graphical management. The commands work identically across supported Ubuntu releases and their derivatives.
Check Your UFW Firewall Status
To begin, Ubuntu newcomers should launch the command terminal. This can be accessed by navigating to the top left corner, selecting Activities, then Show Applications, and finally Terminal. Alternatively, press Ctrl + Alt + T.

Once the terminal is open, you can determine the current status of your UFW (Uncomplicated Firewall) by executing the following command:
sudo ufw status
An example of what you might see after running this command is shown below:

This output indicates that the firewall is inactive. It’s important to note that Ubuntu does not activate the firewall by default in new installations.
How to Enable UFW Firewall on Ubuntu
Enabling UFW activates a default-deny policy for incoming connections while allowing all outgoing traffic. If you’re connected to a remote server via SSH, you must add an SSH allow rule before enabling the firewall to avoid losing access.
Enabling UFW on Ubuntu is crucial for securing your system. By default, enabling UFW will block all incoming connections while allowing all outgoing connections.
Allow SSH Before Enabling (Remote Servers)
If you are remotely connected via SSH, add an SSH allow rule before activating UFW. Otherwise, enabling the firewall will immediately block your connection and lock you out. Execute the following command to allow SSH:
sudo ufw allow ssh
Desktop users who never connect over SSH can skip this step.
Example output:
joshua@ubuntu-linux:~$ sudo ufw allow ssh Rules updated Rules updated (v6)
Activate the Firewall
After securing SSH access (if applicable), enable UFW using the command below:
sudo ufw enable
Example output:

Verify Firewall Status
After enabling UFW, verify its status to confirm activation. Use the following command to check:
sudo ufw status
Example output:
For users who allowed SSH access, it appears listed under the ‘Action’ column.

View Detailed Firewall Status
For a comprehensive view including default policies and logging levels, use the verbose flag:
sudo ufw status verbose
Example output:
The detailed view confirms that default settings deny incoming traffic and allow outgoing connections.

How to Disable UFW Firewall
When troubleshooting network connectivity issues or testing application behavior, temporarily disabling UFW helps isolate whether firewall rules are blocking traffic. Use the following command:
sudo ufw disable
Example output:
Disabling UFW stops all firewall enforcement immediately. All previously configured rules remain stored and will reactivate when you re-enable the firewall.

Install GUFW: Graphical UFW Manager
Install GUFW Package
For users who prefer graphical interfaces over command-line tools, GUFW (Graphical Uncomplicated Firewall) provides an intuitive way to manage UFW. Install it with the following command:
sudo apt install gufw
Launch GUFW Application
After installation, access GUFW by clicking Activities in the top left corner, selecting Show Applications, and searching for Firewall Configuration in the application menu.

Using GUFW Interface
With GUFW, you can easily enable or disable the UFW firewall. The GUI provides a straightforward toggle for this, as demonstrated in the image below, showing the firewall status as ‘off’:

Manage Firewall Settings in GUFW
GUFW provides an intuitive interface to adjust default policies for incoming and outgoing connections, toggle firewall status on or off, create custom rules for specific ports or applications, and view firewall logs. The graphical approach eliminates command-line complexity while maintaining full control over UFW’s capabilities.
Conclusion
UFW provides straightforward firewall management on Ubuntu through simple enable, disable, and status commands. The critical step for remote servers is allowing SSH before enabling the firewall to prevent lockouts, while the default deny-incoming policy immediately hardens network security once activated. For users seeking graphical control, GUFW delivers the same functionality without terminal commands. Additionally, you can explore advanced UFW configuration for creating custom rules, managing application profiles, and fine-tuning security policies.