How to Set Up a Firewall with UFW on Ubuntu 23.04

To Set Up a Firewall with UFW on Ubuntu 23.04, follow these steps:

Step 1 : Update

Ensure your system is up-to-date by running the following command:

Step 2 : Install UFW

Install Uncomplicated Firewall (UFW) using the following command:

Step 3 : Check Status

Verify the current status of UFW to ensure it is inactive:

Step 4 : Allow SSH

Enable SSH access through the firewall:

Step 5 : (Optional) Allow Other Services

If you're running additional services like HTTP or HTTPS, you can allow them as well. For example, to allow HTTP/HTTPS:

Step 6 : Enable UFW

Activate UFW to start enforcing the rules you've set:

Step 7 : Check Status Again

Verify that UFW is now active and configured correctly:

Congratulations! You have successfully set up a firewall with UFW on your Ubuntu 23.04 system, enhancing its security.