Ubuntu20: How to enable/disable firewall
The default Ubuntu firewall is ufw, which is an acronym for “uncomplicated firewall.” It comes automatically installed on all editions of Ubuntu Desktop and Ubuntu Server. 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. You may find you need to disable ufw if it is blocking some necessary connections, or you can enable it for increased security.
1)The first thing we should do is check the status of the firewall to see if it’s on or off.
1 2 |
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 verbose option.
1 |
sudo ufw status verbose |
2)To disable the Ubuntu firewall, execute the following command.
1 |
sudo ufw disable |
3)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.
1 |
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.
1 |
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.