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:
- Check UFW Status: First, you need to check the status of UFW using the following command:
sudo ufw status
- Enable UFW: If UFW is not running, enable it using the following command:
sudo ufw enable
- 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.
- 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.
- 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.
- 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.