Installing and Configuring UFW on Debian
Posted: Sat Apr 25, 2026 10:56 am
Installing and Configuring UFW on Debian
UFW (Uncomplicated Firewall) is a simple and user-friendly firewall management tool for Linux systems. It acts as a frontend for iptables/nftables and allows administrators to control network traffic without writing complex rules.
It is ideal for securing Debian servers running services like SSH, web servers, mail systems, or DNS.
Why Use UFW?
A firewall is a critical part of server security. With UFW you can:
Installation
First update your system:
Then install UFW:
Check status:
Output:
Basic Configuration
Set secure default policies:
This means:
Important: Allow SSH First
Before enabling UFW, allow SSH access:
or:
If you skip this step, you may lock yourse…login to view the rest of this post
UFW (Uncomplicated Firewall) is a simple and user-friendly firewall management tool for Linux systems. It acts as a frontend for iptables/nftables and allows administrators to control network traffic without writing complex rules.
It is ideal for securing Debian servers running services like SSH, web servers, mail systems, or DNS.
Why Use UFW?
A firewall is a critical part of server security. With UFW you can:
- Block unwanted incoming connections
- Allow only required services
- Protect SSH access
- Manage firewall rules easily
- Enable logging for monitoring
Installation
First update your system:
Code: Select all
apt update
Code: Select all
apt install ufw
Code: Select all
ufw status
Code: Select all
Status: inactive
Basic Configuration
Set secure default policies:
Code: Select all
ufw default deny incoming
ufw default allow outgoing
- Incoming traffic is blocked
- Outgoing traffic is allowed
Important: Allow SSH First
Before enabling UFW, allow SSH access:
Code: Select all
ufw allow OpenSSH
Code: Select all
ufw allow 22/tcp