ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software»
  • Computer Software

Configuring Ubuntu Firewall (UFW)

Updated on December 26, 2010

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


    0 of 8192 characters used
    Post Comment

    • That Grrl profile image

      Laura Brown 5 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.

    • MrRichard profile image

      MrRichard 6 years ago from Canada

      @sailor2001 That's a typo :)

    • profile image

      sailor2001 6 years ago

      what's a diable?