SecurityIntermediate15 min
How to Secure Your VPS with UFW Firewall
Learn how to configure UFW firewall to protect your server from unauthorized access
Introduction
UFW (Uncomplicated Firewall) is a user-friendly firewall management tool for Linux. This guide will help you secure your VPS.
Step 1: Install UFW
Install UFW if it's not already installed on your system.
sudo apt update
sudo apt install ufwStep 2: Set Default Policies
Configure default policies to deny incoming and allow outgoing traffic.
sudo ufw default deny incoming
sudo ufw default allow outgoingStep 3: Allow SSH
Allow SSH connections before enabling the firewall to avoid being locked out.
sudo ufw allow 22/tcpStep 4: Allow HTTP and HTTPS
If you're running a web server, allow HTTP and HTTPS traffic.
sudo ufw allow 80/tcp
sudo ufw allow 443/tcpStep 5: Enable UFW
Enable the firewall and verify the status.
sudo ufw enable
sudo ufw status verboseConclusion
Your VPS is now protected by UFW firewall. Remember to allow any additional ports your applications need before enabling the firewall.
#UFW#Firewall#Security#Linux#Ubuntu