ufw-reject
Reject traffic through Uncomplicated Firewall
TLDR
SYNOPSIS
ufw [--dry-run] reject [rule]
DESCRIPTION
ufw reject adds a reject rule to Uncomplicated Firewall so matching packets are refused and the peer is told (similar to iptables REJECT). It is a ufw subcommand, not a separate binary.Rules can be simple port rejections (`ufw reject 23/tcp`), source or network blocks (`ufw reject from 203.0.113.0/24`), or full five-tuple style rules with source, destination, port, protocol, and interface.Use reject when the sender should learn the port is closed. Use ufw deny when you want a silent drop. List rules with `ufw status numbered` and remove them with ufw delete.
PARAMETERS
reject
Refuse matching traffic and send a rejection response (inserts a reject/REJECT rule)port[/protocol]
Simple form: port number, optional /tcp or /udpfrom address
Match source address or network (CIDR)to address
Match destination addressport port
Destination port (or range) when using full rule syntaxproto protocol
Protocol: tcp, udp, igmp, gre, etc.in / out
Direction of trafficon interface
Limit rule to a network interfacecomment 'text'
Attach a human-readable comment to the rule--dry-run
Show what would change without applying it
INSTALL
CAVEATS
Requires root or sudo. Rule order matters when combined with allows. Application profile names must match installed profiles under `/etc/ufw/applications.d/`. Rejecting SSH while managing a remote host can lock you out; prefer --dry-run and keep alternate access.
HISTORY
Part of ufw (Uncomplicated Firewall), the Ubuntu-originated frontend for iptables/nftables.
SEE ALSO
ufw(8), ufw-allow(8), ufw-deny(8), ufw-enable(8), ufw-disable(8), iptables(8), nftables(8)
