How to set up Tor and Privoxy on Ubuntu Linux

About Tor

Tor, an innovation of the Electronic Frontier Foundation, is a distributed network of virtual tunnels (you can think of it as a peer to peer network of proxy servers). Essentially data is transferred in encrypted form through multiple servers. It is very useful as a privacy measure because the data is encrypted and it’s very difficult to find the source of the data directly. It also comes in handy for getting around overly restrictive firewall policies (such as the Chinese government firewall, or the firewall my university campus network has) because it can be tunneled over any port you wish.

Overview [Tor]

About Privoxy

Privoxy is basically an HTTP proxy that has the additional feature of hiding all DNS requests. This is simply used on top of Tor to provide that additional layer of privacy (Tor behaves as a SOCKS 4 proxy, and as such browsers can leak requests if it’s used directly instead of going through Privoxy).

What you need

  • A computer running Ubuntu 6.06 on which you have root privileges
  • An internet connection

Installation

Open /etc/apt/sources.list as root in your favorite text editor, and add the following line to the end

# Tor
deb http://mirror.noreply.org/pub/tor dapper main
deb-src http://mirror.noreply.org/pub/tor dapper main

Then, open a terminal, and install the necessary components by executing the following commands:

sudo apt-get update
sudo apt-get install tor privoxy tsocks

Configure Privoxy to use Tor

Open /etc/privoxy/config as root in your favorite text editor, and add the following line to the top of the file (don’t forget the dot at the end of the line, it’s important):

forward-socks4a / localhost:9050 .

If you’re using Privoxy for privacy, you might also want to disable logging. To do that comment out the following lines in the file by putting a # before them:

logfile logfile
jarfile jarfile

Configure Tor’s ports to use HTTP/HTTPS (useful for getting through firewalls)

Add the following lines to /etc/tor/torrc

ReachableDirAddresses *:80
ReachableORAddresses *:443

Configure tsocks (for quick and easy tunneling of applications on the fly without configuring)

Edit /etc/tsocks.conf and edit the server lines at the bottom to look like this

server = 127.0.0.1
server_type = 4
server_port = 9050

Once you have done that, you can now use tsocks to start applications tunneled like so:

tsocks <command>

You can also start a tunneled subshell like this:

tsocks

Configuring individual applications for Tor

HTTP Proxy: localhost:9118 (this configuration is preferred for privacy but does not work for all applications).

SOCKS 4 Proxy: localhost:9050 (don’t use this if the above works due to the potential for DNS request leakage).

Alternatively, you can use tsocks to start applications that don’t support configuration (also can suffer from DNS leakage).

I hope you enjoyed this post!

This post was submitted to ProBlogger’s ‘how to’ writing project. Make sure to check it out and read the useful ‘how to’ posts others have written.

Linux/BSD/Unix Install Instructions [Tor]


28 Responses to “How to set up Tor and Privoxy on Ubuntu Linux”  

  1. 1 Scott Howard

    Ubuntu rocks!!!!! I have a post on my blog about Ubuntu CE if you want to check it out at http://www.dipnoi.org/archives/category/technology/page/2/

    Also, I contributed to the Group Writing Project as well, here is my post http://www.dipnoi.org/archives/category/salvation/

    Keep up the good work

  2. 2 MamaDuck

    Oh, what fun. Now if I wasn’t stuck with this Mac…. ;) Our list is up as well if you’d like to check it out!!

  3. 3 Jersey Girl

    Wow, it’s like a foreign language to me! I love these writing projects because I see so many things I wouldn’t normally read, and it’s always neat to learn new things.

  4. 4 Northern Girl

    I wish I understood more about this stuff…I have a lot of learning to do, I guess.

    (Found you through ProBlogger)

  5. 5 thackbarth

    Didn’t work:

    tor
    Sep 27 10:55:28.395 [notice] Tor v0.1.0.16. This is experimental software. Do not rely on it for strong anonymity.
    Sep 27 10:55:28.396 [warn] config_assign_line(): Unknown option ‘ReachableDirAddresses’. Failing.
    Sep 27 10:55:28.396 [err] tor_init(): Reading config failed–see warnings above. For usage, try -h.

  6. 6 Corvillus

    That’s an older version of tor. The instructions if followed should give you tor v0.1.1.23, which supports that directive. It was added in Tor 0.1.1.14-alpha, which you don’t have, so you probably should upgrade. If you don’t wish to do that, you could try replacing

    ReachableDirAddresses *:80
    ReachableORAddresses *:443

    with

    FascistFirewall 1
    FirewallPorts 80,443

  7. 7 bigodines

    amazing!! it worked perfectly. thank you very much.

    cheers

  8. 8 Corvillus

    I’m glad you found it useful.

  9. 9 digital camera

    heyas all.
    my 40 gig drive is going to good use now. I have installed UBUNTU and have ordered KUBUNTU.
    I dont know how to install the driver for my ati radeon 9600xt.
    Actually i dont know if i am meant to be downloading and installing XFREE86 or the XORG version of the driver. I am downloading them both but i dont know how to do anything in Linux really.
    I dont know where I am meant to set up my modem or set up a net account. (no INETWIZ.EXE)
    So yeah, can someone help me out with getting my ATI driver installed?
    and does anyone know of a good long PDF file i can read and wrap my brain around.
    I’m still a Windows user, but I want to use Linux as much as possible.
    Thanks. :)

  10. 10 Corvillus

    I think you need to install xorg-driver-fglrx and change the “Driver” line in /etc/X11/xorg.conf from “ati” to “fglrx”, then restart X. Not 100% sure though, I’d check over at http://ubuntuforums.org/ to make sure.

  11. 11 uhuru

    I am trying to install tor, i followed your instruction but I get:

    Nov 01 00:39:24.076 [warn] /var/lib/tor is not owned by this user (debian-tor, 112) but by root (0). Perhaps you are running Tor as the wrong user?
    Nov 01 00:39:24.076 [warn] Failed to parse/validate config: Couldn’t access/create private data directory “/var/lib/tor”
    Nov 01 00:39:24.077 [err] tor_init(): Reading config failed–see warnings above. For usage, try -h.
    invoke-rc.d: initscript tor, action “start” failed.
    dpkg: errore processando tor (–configure):
    il sottoprocesso post-installation script ha restituito un codice di errore 1
    Sono occorsi degli errori processando:
    tor
    E: Sub-process /usr/bin/dpkg returned an error code (1)

  12. 12 Corvillus

    I don’t know if this is the problem or not, but it sounds like you’re not running apt-get as root. Did you prefix the 2 apt-get commands with sudo as listed in the guide? And, do you have privileges to sudo to root?

  13. 13 reEz

    helo there…i’m having the same problem with you as my place administrator only allows us to download below that 2mb..it is crazy..i want to figure out how to solve this using torr..i’m using fedora right now..i will changed to ubuntu around this week as i want to try this and i hope corvillus can teach me how to make install this distro in portable(external) harddisk(i need to to this as i can easily go to another place then download some requiredment stuff about torr).Another one i heard there is revolution of torr which is TRUE..how about if i install Nubuntu(the latest distro from ubuntu family)..can you help me to figure out how to set my connection so that i can bypass my local administrator rules and download more than 2mb..really need help..this problem really freak me out..

    ~AlexanDer reEz~

  14. 14 rahmetli

    i did all of above except

    ReachableDirAddresses *:80
    ReachableORAddresses *:443

    But i have a question,
    for example if i enter the command
    tsocks curl http://www.whatismyip.com
    or
    tsocks nmap -sV -P0 http://www.somedomain.com

    will there still be any DNS leakage?

  15. 15 Corvillus

    Unfortunately, Tor will have DNS leakage if used on its own. You need to use Privoxy to prevent this.

  16. 16 sharetipsinfo

    Weekly Trend for the Week September 17th - 21st 2007
    BSE Sensex: (15604)
    Nifty (4518)
    14. 09. 2007

    Market is in stretched zone.Technically trendis still intact up but due to overstretched, correction is due. Technically market to come down now. Its being 2 week market has not shown any significance movement and is trading in sideway zone due to which there is no trending movement.

    Trend is still up but minor correction can’t be ruled out. It will be correction first then again up move and market will remain volatile throughout.

    The crucial support for the href=”http://www.sharetipsinfo.com/”title=”Sensex”>Sensex is at 15348 the resistance to the up move at 15868-16222

    The crucial support for the href=”http://www.sharetipsinfo.com/”title=”NIFTY”>NIFTY is at 4444 the resistance to the up move at 4646-46700

    Right now There are few scripts which are looking quite good from short term prespective. Buy them at declines .

    Scripts are:-

    1.PSTL

    2.PENNINLAND

    Please feel free to contact us
    for any query.

    Reagrds

    SHARETIPSINFO

    09891655316
    09899056796
    09891890425

  17. 17 phone

    “HTTP Proxy: localhost:9118 (this configuration is preferred for privacy but does not work for all applications).”

    I thought the default was 8118?

  1. 1 63 ‘How to’ Posts to Add Spice to Your Day - Group Writing Project Day 1
  2. 2 Kristonia Ink! » Full List of ProBlogger How To Contest Submissions
  3. 3 Change your thoughts » Blog Archive » How to posts - loads of them
  4. 4 Ask blushgirl - Romance Advice, Tips and Dating Site Reviews » Blog Archive » Day 1 of the Problogger How-To Articles Submissions
  5. 5 Questallia » Problogger’s ‘How to’ Group Writing Project List
  6. 6 Mark Choon » The Biggest, really humongous, ‘How To’ list ever assembled in 4 days!
  7. 7 Chewing Pencils: Helping you make money from drawing cartoons!
  8. 8 CJCM and IT » Blog Archive » Problogger’s Group Writing Project
  9. 9 Cell Phone Know How » 343 How To Posts
  10. 10 The Scott English Show - » More How To’s then you Could Poke a Stick At
  11. 11 Freeware and Shareware Software Downloads


Leave a Reply