Back to the command reference

ufw

NetworkFundamentalsReference only

Uncomplicated firewall (Ubuntu)

Name: ufw = Uncomplicated Firewall

This command is outside what the site lets you practise (mostly distribution-specific or rarely used tools). This page describes how to use it; try it on your own Linux system.

Description

ufw is Ubuntu's firewall front end, managing the underlying iptables/nftables rules with simple allow and deny commands. On a remote server, allow SSH before enabling it or you will lock yourself out.

Syntax

ufw COMMAND

Common options

enable / disableTurn the firewall on / off
statusStatus and rules
allow / denyAllow / deny a port or service
limitRate-limit connections (against brute force), e.g. ufw limit ssh
deleteDelete a rule, e.g. ufw delete allow 80
defaultSet the default policy, e.g. ufw default deny incoming

Examples

  • $ sudo ufw allow 22/tcp

    Allow SSH

    Explain
  • $ sudo ufw enable

    Enable the firewall

    Explain
  • $ sudo ufw status numbered

    Numbered rules

    Explain

Related