LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

ufw-allow

Allow traffic through Uncomplicated Firewall

TLDR

Allow all traffic on a port
$ sudo ufw allow [port]
copy
Allow traffic for a protocol on a port
$ sudo ufw allow [port]/[protocol]
copy
Allow a known application profile
$ sudo ufw allow OpenSSH
copy
Allow all traffic from a source address
$ sudo ufw allow from [source_address]
copy
Allow TCP from one host to another on port 443
$ sudo ufw allow from 192.168.1.12 to 192.168.1.100 port 443 proto tcp
copy
Allow with a comment for documentation
$ sudo ufw allow 5432 comment "PostgreSQL"
copy
Simulate an allow rule without applying it
$ sudo ufw --dry-run allow 80/tcp
copy

SYNOPSIS

ufw [--dry-run] allow [rule]

DESCRIPTION

ufw allow adds an allow rule to Uncomplicated Firewall so matching packets are accepted. Rules can be simple port allows (`ufw allow 22/tcp`), service or application profiles (`ufw allow OpenSSH`), or full five-tuple style rules with source, destination, port, protocol, and interface.Allow rules are typically configured before `ufw enable` on remote hosts so SSH and other admin access remain available. Use `ufw status numbered` to list rules and `ufw delete` to remove them by number.

PARAMETERS

allow

Permit matching traffic (inserts an allow rule)
port[/protocol]
Simple form: port number, optional /tcp or /udp
from address
Match source address or network (CIDR)
to address
Match destination address
port port
Destination port (or range) when using full rule syntax
proto protocol
Protocol: tcp, udp, gre, etc.
in / out
Direction of traffic
on interface
Limit rule to a network interface
comment 'text'
Attach a human-readable comment to the rule
--dry-run
Show what would change without applying it

INSTALL

sudo dnf install ufw
copy
sudo pacman -S ufw
copy
sudo apk add ufw
copy
sudo zypper install ufw
copy

CAVEATS

Requires root or sudo. Order and default policies (`ufw default deny incoming`) matter — an allow rule only helps if the default policy would otherwise block the traffic. Application profile names must match installed profiles under `/etc/ufw/applications.d/`.

HISTORY

Part of ufw (Uncomplicated Firewall), the Ubuntu-originated frontend for iptables/nftables.

SEE ALSO

RESOURCES

Copied to clipboard
Kai