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

Comments 3 comments

sailor2001 5 years ago

what's a diable?


MrRichard profile image

MrRichard 5 years ago from Canada Author

@sailor2001 That's a typo :)


That Grrl profile image

That Grrl 4 years ago from Barrie, Ontario, Canada

Is there something like defrag for Ubuntu? Or is that just a Windows thing? A bit off topic but the firewall was my other big question with running Ubuntu and you've given me an answer to that already.

    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.


    Click to Rate This Article
    working