Home » Blog » Hacks » Steps to Enable/Disable UFW in Ubuntu – Protect your Linux

Steps to Enable/Disable UFW in Ubuntu – Protect your Linux

Steps to Enable-Disable UFW in Ubuntu

Steps to Enable/Disable UFW in Ubuntu. Ubuntu is a popular Linux distribution known for its ease of use and security features. One of the security features included in Ubuntu is UFW (Uncomplicated Firewall). UFW is a user-friendly interface for managing firewall rules and can be used to protect your Ubuntu system from unauthorized access.

In this guide, we will show you how to enable UFW in Ubuntu and how to use it to protect your system.

Prerequisites

Before we begin, ensure that you have the following prerequisites:

  • An Ubuntu system
  • Root access to your system
  • An internet connection

Step 1: Install UFW

By default, UFW is not installed on Ubuntu. To install UFW, run the following command:

sudo apt-get install ufw

This command installs UFW on your Ubuntu system.

Step 2: Enable UFW

Once UFW is installed, the next step is to enable it. To enable UFW, run the following command:

sudo ufw enable

This command enables UFW and starts the firewall service.

Step 3: Configure Firewall Rules

After enabling UFW, you can configure firewall rules to allow or deny incoming and outgoing traffic. For example, to allow SSH traffic, run the following command:

sudo ufw allow ssh

This command allows incoming SSH traffic to your Ubuntu system. You can also specify a port number to allow traffic on a specific port.

Similarly, to deny incoming HTTP traffic, run the following command:

sudo ufw deny http

This command denies incoming HTTP traffic to your Ubuntu system.

Step 4: Check Firewall Status

To check the status of UFW, run the following command:

sudo ufw status

This command displays the status of UFW and the firewall rules that are currently configured.

Step 5: Disable UFW

If you want to disable UFW, you can run the following command:

This command disables UFW and stops the firewall service.

sudo ufw disable

Conclusion

In this guide, we’ve shown you how to enable and use UFW in Ubuntu to protect your system from unauthorized access. With UFW, you can configure firewall rules easily and ensure the best security for your Ubuntu system. Remember to keep your firewall rules up-to-date to ensure the best protection against potential security threats.

Scroll to Top