How To Enable or Disable firewall on Ubuntu 22.04/20.04
Firewall is all about protecting your system from any possible threats. Without any further explanation, let’s go through the process where we will you the method to enable or disable firewall on Ubuntu based operating systems.
Enable or Disable Firewall on Ubuntu 22.04 or 20.04
Run the following command to find out the status of UFW firewall in your Ubuntu using the command.
sudo ufw status
Output:
steve@ubuntu-linux:~$ sudo ufw status Status: inactive steve@ubuntu-linux:~$
The firewall in your Ubuntun is inactive, as Ubuntu distro does not enable this by default for new installations.
Enable UFW Firewall on Ubuntu
Now to enable firewall in Ubuntu, You can add UFW rules while the service is inactive, allowing the SSH service.
sudo ufw allow ssh
Example output:
steve@ubuntu-linux:~$ sudo ufw allow ssh Rules updated Rules updated (v6)
Now run the following command to enable the firewall.
sudo ufw <enable
Example output:
steve@ubuntu-linux:~$ sudo ufw enable Firewall is active and enabled on system startup
Next, You can run the following command to check your Ubuntu firewall by re-using the ufw status command.
sudo ufw status
Example output:
steve@ubuntu-linux:~$ sudo ufw status Status: active To Action From -- ------ ---- 22/tcp ALLOW Anywhere 22/tcp (v6) ALLOW Anywhere (v6)
Disable UFW Firewall on Ubuntu Linux
Run the following command to disable the UFW firewall on Ubuntu.
sudo ufw disable
Example output:
steve@ubuntu-linux:~$ sudo ufw disable Firewall stopped and disabled on system startup
Conclusion
In this Ubuntu tutorial, We taught you how to enable or disable the UFW firewall on Ubuntu Linux from the command line . Let us know if you have any other way to enable or disable firewall in Ubuntu Linux.
Meanwhile, Don’t forget to share and also let us know your opinion on our article “How To Enable or Disable firewall on Ubuntu 22.04/20.04” in the comment box below.