Home > Other External Packages > ufw

Mastering the ufw Command

`ufw` (Uncomplicated Firewall) is a command that makes it easy to manage firewalls in Ubuntu/Debian environments. It is important to fully understand its basic operation principles and options as it is the first step in server security.

Main Options

`ufw` provides essential management functions such as checking firewall status, adding/removing rules, and enabling/disabling the firewall.

1. Firewall Status/Basic Management

2. Add/Delete Rules

3. Other Main Options

Generated command:

Try combining the commands.

Description:

`ufw` Executes the command.

Combine the above options to virtually execute commands with AI.

Usage Examples and Practical Tips

We present usage examples and common patterns that you must know when using `ufw` in real server operations.

Points to Note When Operating ufw

Firewall settings can completely cut off server access, so be sure to check the following items.

  • Blocking SSH access (port 22) may prevent remote access to the server.
  • Always allow the SSH port in advance with `ufw allow 22`.
  • Always check the application results with `ufw status` before applying rules.
  • 'Delete by Number' feature is useful for preventing mistakes.

Enable/Disable Firewall

sudo ufw enable

Commands to turn the firewall on or off.

Allow Specific Port

sudo ufw allow 22

Example: Allow only the SSH port (22).

Allow Access from Specific IP Only

sudo ufw allow from 203.0.113.5

An example of allowing only a specific IP.

Delete Rule (by Number)

sudo ufw delete 2

Delete a rule with the number checked via `ufw status numbered`.


Same category commands