Page 1 of 1

Installing and Configuring UFW on Debian

Posted: Sat Apr 25, 2026 10:56 am
by Admin
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:
  • 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
Then install UFW:

Code: Select all

apt install ufw
Check status:

Code: Select all

ufw status
Output:

Code: Select all

Status: inactive

Basic Configuration

Set secure default policies:

Code: Select all

ufw default deny incoming
ufw default allow outgoing
This means:
  • Incoming traffic is blocked
  • Outgoing traffic is allowed

Important: Allow SSH First

Before enabling UFW, allow SSH access:

Code: Select all

ufw allow OpenSSH
or:

Code: Select all

ufw allow 22/tcp
If you skip this step, you may lock yourse…login to view the rest of this post