Overview
ufw status shows the current status (enabled/disabled) of the UFW firewall, along with all rules applied to inbound and outbound connections. This provides crucial information for understanding and managing the system's security policies.
Key Features
- Check the activation status of the UFW firewall
- Display a list of all currently applied firewall rules
- View default policies (e.g., deny incoming, allow outgoing)
- Output includes rule numbers for easier management of specific rules
Key Options
The ufw status command offers several useful options to control the output format.
Output Formats
Generated command:
Try combining the commands.
Description:
`ufw status` Executes the command.
Combine the above options to virtually execute commands with AI.
Usage Examples
Demonstrates various ways to check firewall status using the ufw status command.
Check Basic Firewall Status
sudo ufw status
Verify the current active status and a simple list of rules for the UFW firewall.
Check Detailed Firewall Status
sudo ufw status verbose
View more detailed information, including default policies, interface-specific rules, and logging status.
Check Status with Rule Numbers
sudo ufw status numbered
Output rules with numbers, useful for deleting or managing specific rules.
Installation
UFW is included by default on most Debian/Ubuntu-based systems or can be easily installed. It may need to be installed separately on other distributions.
Debian/Ubuntu Based Systems
sudo apt update
sudo apt install ufw
Install UFW using the APT package manager.
Fedora/RHEL Based Systems
sudo dnf install ufw
Install UFW using the DNF package manager. (Default firewall is firewalld)
Arch Linux Based Systems
sudo pacman -S ufw
Install UFW using the Pacman package manager.
Tips & Precautions
Tips and precautions for effectively using the ufw status command and managing your firewall securely.
Verify After Firewall Rule Changes
After adding new rules or deleting existing ones, always run `sudo ufw status` to confirm that the changes have been applied correctly.
- Verify with `ufw status` after adding/deleting rules
- Especially when working on remote servers, be cautious about SSH connections being dropped while applying rules
Utilize Rule Numbers
After checking rule numbers with `sudo ufw status numbered`, you can easily delete specific rules using the `sudo ufw delete [number]` command.
- Check rule numbers with `ufw status numbered`
- Delete specific rules with `ufw delete [number]`
Enable/Disable Firewall
If UFW is inactive, you can enable it with the `sudo ufw enable` command. Be aware that existing rules will be applied upon activation.
- Check inactive status: `Status: inactive`
- Enable: `sudo ufw enable`
- Disable: `sudo ufw disable` (use with extreme caution)