UnixDroid

Defence · Beginner

UFW Firewall tutorial for beginners

Protect a Linux machine with a few simple rules

UFW Firewall screen demo — an illustration with sample data

What is UFW Firewall?

UFW (Uncomplicated Firewall) is the easy firewall tool on Ubuntu and many other Linux systems. It decides which incoming connections are allowed and blocks the rest.

How UFW Firewall works

  1. 1

    A connection arrives

    Something tries to reach a port.

  2. 2

    Rules are checked

    UFW looks for a matching allow or deny rule.

  3. 3

    Allowed passes

    Trusted services work normally.

  4. 4

    Everything else stops

    Default deny protects forgotten services.

What is a firewall?

A gatekeeper for network connections.

A safe first setup

  1. Deny incoming by default
  2. Allow only what you need (for example SSH and web)
  3. Allow SSH before enabling on a remote server
  4. Turn it on and check the status

UFW Firewall first steps

sudo ufw default deny incoming

Block incoming by default

sudo ufw allow OpenSSH

Keep remote access

sudo ufw allow 443/tcp

Allow secure web traffic

sudo ufw enable

Switch the firewall on

sudo ufw status verbose

See the rules

Use UFW Firewall safely and legally

On a remote server, add the SSH rule first or you may lock yourself out.

Practise only on your own computer, your own network or a lab that gives you permission. Using security tools on systems that are not yours can be a crime (in India under the IT Act).

UFW Firewall — common questions

What is UFW Firewall used for?

UFW (Uncomplicated Firewall) is the easy firewall tool on Ubuntu and many other Linux systems. It decides which incoming connections are allowed and blocks the rest.

Firewall kya hai?

Firewall network connections ka gatekeeper hai jo tay karta hai kaunsa connection aaye aur kaunsa nahi.

Does UFW replace antivirus?

No. They protect against different things; use updates and good passwords too.

How do I delete a rule?

Run sudo ufw status numbered, then sudo ufw delete <number>.

Related topics: ufw firewall tutorial · linux firewall · firewall kya hai · ubuntu security