Configuring Ubuntu Firewall (UFW)
Ubuntu has hands down the best virus protection for an operating system. Why? It's because of two things that coincide almost perfectly; open source and....a password. Yep, that password that is always prompted whenever you're trying to install a software or edit a setting saves your computer from being tampered with by viruses. Not too long ago, a virus was found in the update repositories which was downloaded to thousands of computers already. Within four hours, an update was made to remove that virus from the infected computers. The speedily repair was thanks to open source and a community of awesome people.
Uncomplicated Firewall (UFW) is surprisingly turned off by default, but is installed on all Ubuntu computers. The purpose of the firewall is to set simple rules, such as deny all data coming through port 21.
There is an easy way and a hard way to enable UFW.
The Easy way
First, you need to open up Ubuntu Software Centre and search for "UFW" without the quotes. Install the second app that appears. Next go to System->Administration->Firewall Configuration to setup the firewall however you like.
The Hard Way
For those who like to save hard disk space and love the terminal, this is the better way. Open up a terminal and type:
sudo ufw enable
If you want to open a port, enter:
sudo ufw allow "port number without quotes"
To block a port, enter:
sudo ufw deny "port number without quotes"
To delete a rule, enter:
sudo ufw delete "port rule without quotes"
To disable the firewall, enter:
sudo ufw disable