MagicHosting Logo
Back to blog

Magichosting

UFW firewall on Linux: open, close and secure ports

E
Elias Bieber
Estimated reading time: 1 min

Use UFW on Debian and Ubuntu: install, open ports (allow/deny), check status and avoid accidentally blocking SSH on port 22.

LinuxUFWFirewallPortsDebian

Install UFW

With UFW (Uncomplicated Firewall) you can manage ports on Linux easily.

sudo apt install ufw

Open and close ports

Open port (example 8080):

ufw allow 8080

Close port:

ufw deny 8080
  • ufw status: Shows firewall status
  • ufw enable: Enables the firewall
  • ufw disable: Disables the firewall
  • Important: Do not block port 22 (SSH) or you will lose access!

Was this post helpful?

MagicHosting – Hosting with real value

Hosting pays off with MagicHosting: fair pricing, current deals and reliable operation from Frankfurt. We offer servers, domains and personal support – no hidden costs.

  • Current special sales with discounts on servers and packages
  • Affordable domains with transparent pricing and great offers
  • Powerful DDoS protection for maximum availability
  • Personal support when you have questions or issues
Contact on WhatsApp