Appearance
Install & Configure UFW
This post explains how to install & configure UFW Firewall on Debian or Ubuntu and which commands are useful.
Installation
- Update packages and install UFW
sh
sudo apt update
sudo apt install ufw- Check UFW service status
sh
sudo ufw status- Set default rules
sh
sudo ufw default deny incoming
sudo ufw default allow outgoingThis blocks everything coming in and allows everything going out.
- Allow ssh connections
sh
sudo ufw allow sshWithout this after UFW is active you will be locked out!
- Enable UFW
sh
sudo ufw enableUsefull Commands
Enable UFW
sh
sudo ufw enableDisable UFW
sh
sudo ufw disableReload Rules
sh
sudo ufw reloadShow status and rules (numbered)
sh
sudo ufw status numberedDelete a Rule
sh
sudo ufw delete <number>