Ufw setup in Ubuntu

ufw stands for Uncomplicated Firewall.

If ufw is not installed in the system, then install it with the command:

sudo aptitude install ufw

The command activates ufw in the system, it will also be included every time the system starts:

sudo ufw enable

If ufw does not start after restarting the system, then edit ENABLED=no to ENABLED=yes in the file:

sudo nano /etc/ufw/ufw.conf

To disable is used:

sudo ufw disable

Deny all incoming connections:

sudo ufw default deny

To allow access for a subnet or address:

sudo ufw allow from 10.0.0.0/24

To re-enable all incoming connections:

sudo ufw default allow

Permit SSH connection from outside:

sudo ufw allow ssh

An example of allowing access to a specific port:

sudo ufw allow 80/tcp

View status:

sudo ufw status
sudo ufw status verbose

Disable logging:

sudo ufw logging off

View profiles for applications:

sudo ufw app list

The configuration files are in /etc/default/ufw and /etc/ufw/applications.d

View official documentation:

man ufw

See also my article – Configure IPTables

Did my article help you? How about buying me a cup of coffee as an encouragement? Buy me a coffe.

Leave a comment

Leave a Reply