Security3 min readUpdated 2026-04-30
Firewall basics with ufw
Default-deny inbound, allow only what you need. Standard ufw rules for a typical web VPS.
ufw is a friendly wrapper around iptables/nftables. The right starting policy: deny all inbound by default, allow only the ports your services need.
Install ufw
apt install ufw -y # Ubuntu/Debian
dnf install ufw -y # AlmaLinux/RockySet the default policies
ufw default deny incoming
ufw default allow outgoingAllow your SSH port FIRST
Before enabling the firewall, allow your SSH port — otherwise you lock yourself out:
ufw allow 22222/tcpAllow web traffic
If you're running a web server:
ufw allow 80/tcp
ufw allow 443/tcpEnable
ufw enable
ufw status verboseThe last command shows your full ruleset. Keep it clean — every open port is attack surface.
Deploy your first offshore server in 60 seconds.
Anonymous signup. Bitcoin & Monero accepted. Provisioned across 8 jurisdictions.
No credit card required · 7-day money-back guarantee