Install the official Tor proxy
Tor and its official SOCKS 5 proxy are pretty quick to get running on Ubuntu. Going off of the Tor Project website's installation instructions, do the following:
- Open a terminal by pressing Ctrl+Alt+T
Run the following (replace xenial
with the release you're running if you're not on 16.04 Xenial Xerus):
sudo -i
echo deb http://deb.torproject.org/torproject.org xenial main > /etc/apt/sources.list.d/tor.list
echo deb-src http://deb.torproject.org/torproject.org xenial main >> /etc/apt/sources.list.d/tor.list
gpg --keyserver keys.gnupg.net --recv 886DDD89
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add -
apt update
apt install tor deb.torproject.org-keyring
exit
Now the Tor SOCKS 5 proxy will be running on your machine, 127.0.0.1
, on port 9050
. Remember that this is a SOCKS 5 proxy, not an HTTP proxy.
Your Tor proxy will automatically start when your machine boots. You can run sudo service tor restart
or other actions like start
, stop
, and status
to control the Tor proxy on your machine.
Apt through Tor
Going off of the apt-transport-tor Github README, to get apt
to work through Tor:
- Back up
/etc/apt/sources.list
and all .list
files in /etc/apt/sources.list.d
- Open a terminal by pressing Ctrl+Alt+T
Run the following:
sudo -i
apt update
apt install apt-transport-tor
sed -i 's/ http/ tor+http/g' /etc/apt/sources.list /etc/apt/sources.list.d/*.list
apt update
exit
Make sure to fix any error messages that appear (if needed, restore the files you backed up)
Note: Be aware that some programs, like Google Chrome, will modify their .list
file, so those programs may automatically switch back to trying to connect directly when checking for updates instead of going through Tor.
In-program proxy settings
A lot of programs connect just fine through Tor if you edit the proxy settings to:
- Host:
127.0.0.1
- Port:
9050
- Proxy type (if it asks):
SOCKS5
- Username/Password (if it asks): both set to the name of the program
Proxy wrapper
Other programs, like irssi
, need to use torsocks
. There are two ways of doing this:
torsocks
gives error messages:
torsocks -i command arguments
torsocks
is quiet (useful for programs like irssi
that assume they fully control what's shown on the terminal):
TORSOCKS_LOG_LEVEL=1 torsocks -i command arguments