Question: How do I install Tor (The Onion Router) software under Debian / Ubuntu Linux? How do I communicate anonymously on the Internet? How do I anonymously browser the Internet so that I can avoid network surveillance that threatens personal freedom and privacy under Linux operating systems?

Answer: Onion routing is a system enabling its users to communicate anonymously on the Internet. You need to install following softwares:

[a] tor – a free software implementation of second-generation onion routing for Windows / Linux / UNIX computer systems.

[b] privoxy – a non-caching web proxy with advanced filtering capabilities for enhancing privacy, modifying web page data, managing HTTP cookies, controlling access, and removing ads, banners, pop-ups and other obnoxious Internet junk. Privoxy has a flexible configuration and can be customized to suit individual needs and tastes. Privoxy has application for both stand-alone systems and multi-user networks.

WARNING! These examples and faq is about anonymity and not about security. Tor can be easily used to see sensitive data by exit nodes. Do not mistake Tor’s anonymity for security.

Install tor and privoxy

Type the following command as root user or use sudo command:
$ sudo apt-get install tor privoxy

Linux tor and privoxy configuration

By default tor listen on TCP port # 9050. Open /etc/privoxy/config file, enter:
$ sudo vi /etc/privoxy/config
Append / change following config directive to chain Privoxy and Tor, both running on the same system:

forward-socks4a   /      .

Save and close the file. Restart privoxy:
$ sudo /etc/init.d/privoxy restart

Sample privoxy config file

See man page for detailed information (above configuration is sufficient to get started with tor)

# Generally, this file goes in /etc/privoxy/config
forward-socks4a / .
confdir /etc/privoxy
logdir /var/log/privoxy
actionsfile standard
actionsfile default  
actionsfile user     
filterfile default.filter
debug   4096 
debug   8192 
user-manual /usr/share/doc/privoxy/user-manual
toggle  1
enable-remote-toggle 0
enable-edit-actions 0
enable-remote-http-toggle 0
buffer-limit 4096

Configure browser for tor

Open Firefox click on Edit > Preferences > Advance tab > Settings:

Fig.01: Tor with Firefox network settings

Fig.01: Tor with Firefox network settings

Set and 8118 as privoxy server IP and port number. Now Firefox is ready to use with Tor.

Firefox Torbutton plugin

You can also install Torbutton plugin, for best safety. Simply grab and install the Torbutton plugin, restart your Firefox, and you’re all set to use Tor. From the project page:

Torbutton provides a button to securely and easily enable or disable the browser’s use of Tor. It is currently the only addon that will safely manage your Tor browsing to prevent IP address leakage, cookie leakage, and general privacy attacks.

Further readings:

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 7 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
7 comments… add one
  • bla Nov 13, 2008 @ 22:19

    one word for ya

  • T Jun 19, 2009 @ 11:53

    Can someone please explain: “Tor can be easily used to see sensitive data by exit nodes”?

  • emc Jun 19, 2009 @ 12:53


    In September 2007, Dan Egerstad, a Swedish security consultant, revealed that by operating and monitoring Tor exit nodes he had intercepted usernames and passwords for a large number of email accounts.[15] As Tor does not, and by design cannot, encrypt the traffic between an exit node and the target server, any exit node is in a position to capture any traffic passing through it which does not use end-to-end encryption, e.g. SSL. While this does not inherently violate the anonymity of the source, it affords added opportunities for data interception by self-selected third parties, greatly increasing the risk of exposure of sensitive data by users who are careless or who mistake Tor’s anonymity for security.


  • T Jun 19, 2009 @ 15:27

    Thank you kindly for the info

  • zubs Dec 4, 2009 @ 9:58

    if net is via proxy , username:password

  • JustinTime Feb 12, 2013 @ 19:26

    Tor is slow as fackkk….. I would not recommend using Tor to anyone. Slows down your connected to a crawl. Worse than dialup. I tried and it was horrible. DO NOT Use this.

  • DonaldTrump Oct 2, 2015 @ 1:25

    # Updated sample config file, first do these two commands:

    # touch /var/log/privoxy/privoxy.log
    # chmod 664 /var/log/privoxy/privoxy.log
    forward-socks4a / .
    confdir /etc/privoxy
    logdir /var/log/privoxy
    logfile privoxy.log
    actionsfile default.action
    actionsfile user.action
    filterfile default.filter
    debug   4096
    debug   8192
    user-manual /usr/share/doc/privoxy/user-manual
    toggle  1
    enable-remote-toggle 0
    enable-edit-actions 0
    enable-remote-http-toggle 0
    buffer-limit 4096

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum