How to Enable and Disable UFW Ubuntu Firewall

In This Tutorial We are Going to Learn How to Enable and Disable UFW Ubuntu Firewall. The UFW Firewall is installed by default on Ubuntu Linux, but by default it is disabled.

Enable Ubuntu Firewall

It is very easy to enable the ufw using ufw enable command, But before we enable the firewall we need to make sure we also add a firewall rule to allow ssh connection to our Ubuntu Server. Otherwise, you will be locked out of your server.

sudo ufw allow 22/tcp

sudo ufw enable

First Command allows ssh port 22 from the Ubuntu firewall, Then we enable the firewall using ufw command.

You will receive the following message Firewall is active and enabled on system startup

You can view the ufw firewall status using ufw status command.

sudo ufw status

Enable and Disable UFW Ubuntu Firewall

Disable Ubuntu Firewall

To disable ufw using ufw disable command.

sudo ufw disable

Once you disabled the firewall (UFW), you will receive the following message "Firewall stopped and disabled on system startup"

submit to reddit