Linux Firewall Basics Ufw is a valuable topic for IT professionals who manage Linux systems, web servers, cloud instances, virtual machines, and production services. This tutorial gives practical steps, command examples, and safe administration guidance.
- Learn the concept in practical language
- Understand common production symptoms
- Use Linux commands safely
- Apply troubleshooting and security best practices
Why firewalls matter
A firewall controls which network traffic can reach a server. It reduces exposure and helps protect services from unwanted access.
What is UFW?
UFW stands for Uncomplicated Firewall. It provides a simple interface for managing firewall rules on many Ubuntu-based systems.
Allow only required services
Only open ports that are needed. Common examples include SSH, HTTP, and HTTPS, but each server should be reviewed individually.
Avoid locking yourself out
Before enabling or changing firewall rules on a remote server, make sure SSH access is allowed and you have recovery access.
Review rules regularly
Firewall rules should match current business needs. Remove old rules and document why each open port exists.
Useful Linux commands
sudo ufw status verbose
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
sudo ss -tulpn
Safe server administration checklist
- Check the current state before making changes.
- Back up important files and configuration.
- Test commands in a lab or staging server when possible.
- Make one change at a time and verify the result.
- Document the issue, commands used, and final fix.
Educational note: This tutorial is for learning purposes. Test commands carefully and do not apply changes to production systems without authorization, backups, and a rollback plan.



