Network
The ufw command
Ubuntu's simple firewall. Enables protection and decides which ports are allowed or blocked.
Syntax
sudo ufw status | sudo ufw enable | sudo ufw allow PUERTOMost useful options
statusShows whether it is active and the rulesenableEnables the firewallallowAllows a port or servicedenyBlocks a port or serviceCopy-ready examples
$ sudo ufw statusFirewall status$ sudo ufw allow 22 && sudo ufw status verboseAllow SSHYou can try them in the browser terminal: it does not touch your computer.
Typical mistakes
- When enabling it over an open SSH connection, allow port 22 first or you will lock yourself out.
FAQ
Does ufw replace iptables?
No: ufw is an easy layer on top of iptables.
Learn to actually use it
The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.
Start the free course