How to use UFW (Uncomplicated Firewall) on Linux

5/5 - (46 votes)

UFW (Uncomplicated Firewall) is a firewall management tool used on Ubuntu and other Linux distributions. Here’s a basic guide on how to use UFW:

  1. Check UFW Status: First, you need to check the status of UFW using the following command:
sudo ufw status
  1. Enable UFW: If UFW is not running, enable it using the following command:
sudo ufw enable
  1. Allow or Deny Incoming Traffic: By default, UFW denies all incoming traffic. You can allow incoming traffic for specific services, such as SSH or HTTP, using the following commands:
sudo ufw allow ssh 
sudo ufw allow http

To deny incoming traffic, use the following command:

sudo ufw deny ftp

Note: Replace “ssh”, “http”, or “ftp” with the name of the service or port you want to allow or deny.

  1. Check UFW Rules: You can check the UFW rules using the following command:
sudo ufw status numbered

This will display the numbered list of rules, making it easier to manage and modify them.

  1. Delete a UFW Rule: If you need to delete a UFW rule, use the following command:
sudo ufw delete 2

Note: Replace “2” with the rule number you want to delete.

  1. Disable UFW: If you need to disable UFW, use the following command:
sudo ufw disable

These are some basic steps to use UFW on Linux. Keep in mind that UFW offers a range of advanced features and commands that you can explore by referring to its documentation.

Charles F Flores

With over three years of in-depth experience working in technical fields, Charles is a master content writer who loves writing about Linux and Mac at Easy Tech Tutorials.

Leave a Comment