Last modified: 2022-12-11


It's a network security system that monitors and controls incoming and outgoing network traffic based on predetermined security rules.


ufw status
ufw status verbose

Enable/Disable the Firewall

ufw enable

ufw disable

Set Default Policies

# Allow all
ufw default ALLOW

# Deny all
ufw default DENY


  • Allow

    ufw allow 22
    ufw allow 22/tcp
    ufw allow 80
    ufw allow 80/tcp
    # Allow the given ip address access to port 22 for all protocols
    ufw allow from <ip> to any port 22
  • Deny

    ufw deny 22
    ufw deny 22/tcp
    ufw deny 80
    ufw deny 80/tcp