How to Enable ufw Firewall in Ubuntu 22.04?

By Hardik Savani May 1, 2024 Category : Ubuntu

Hello Developer,

This example is focused on how to enable ufw in ubuntu 22.04. This post will give you a simple example of how to enable ufw in ubuntu 22.04. let’s discuss about ubuntu 22.04 enable firewall command line. I would like to show you ubuntu 22.04 enable ufw. So, let us see in detail an example.

To enable the Uncomplicated Firewall (UFW) in Ubuntu 22.04, follow these step-by-step instructions:

Step 1: Open the Terminal

- You can open the Terminal by pressing `Ctrl` + `Alt` + `T` on your keyboard. This will launch the Terminal application.

Step 2: Check the UFW Status (Optional)

- Before enabling UFW, you may want to check its status to confirm if it's currently disabled. You can do this by running the following command:

sudo ufw status

If UFW is inactive, you will see a message indicating that it's "Status: inactive."

Step 3: Enable UFW

- To enable UFW, use the following command:

sudo ufw enable

You will be prompted for your user password. Enter your password and press Enter.

Step 4: Allow Essential Services (Optional)

- By default, UFW will deny all incoming and outgoing traffic. You can allow specific services or ports as needed. For example, if you want to allow SSH access, you can run:

sudo ufw allow OpenSSH

Replace "OpenSSH" with the name of the service or port you want to allow.

Step 5: Verify UFW Status

- After enabling UFW and allowing necessary services, you can verify its status by running:

sudo ufw status

If UFW is active and has rules configured, you should see a list of allowed services and their associated ports.

That's it! You have successfully enabled and configured UFW on your Ubuntu 22.04 system. UFW will now actively filter network traffic based on the rules you've set up, providing an additional layer of security for your system.

I hope it can help you...

Tags :
Shares