How to Install and Configure UFW – An Un-complicated FireWall in Debian/Ubuntu

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Pungki Arianto

Currently I am a Linux/Unix administrator. But I also play Windows both in server and desktop area. Interested in information technology, information security and writing.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

11 Responses

  1. raj says:

    Hi I am new to Linux Debian. For everyday use is ok to just set the ufw to its defaults and not add any rules.

  2. hurin says:

    Hi, thx for the tutorial, it really helps me out ^^

    By the way, i think there’s a small typo error with the command line => “dpkg –get-selection”
    Isn’t it “dpkg –get-selections” ?

    Anyway, great tutorial, thanks again :)

  3. Websearch2 says:

    sudo ufw allow form -> should be from not form

  4. Pungki Arianto says:

    Hi websearch,

    I never use UFW to block websites. But I think we can use this trick to do it :

    sudo ufw deny out to <> port 80

    But please remember, this will block All access on port 80, on that server.

    If you need to block websites, I think a tool such as Dansguardian may a good option.

  5. websearch says:

    Thanks you.

    Tell me please
    How can blocking sites (example

  6. Dave Dux says:

    I wonder if it’s possible to allow a certain port to open only if the certain application is running. Like ufw to open 51234 tcp port when I start Transmission, but close it when I close Transmission [torrent client]. That would be awesome. :)

  7. Staffan Melin says:

    Very good and simple to follow guide!

    One small error/typo below “List the current ufw rules”: The command should be
    $ sudo ufw status verbose (you forgot the “ufw”)

  8. Mark says:

    Great information, in a simple to understand tutorial. Bookmarked.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.