How to install and run commands via Tor “The Onion Router”

How to install and run commands via Tor and torify command? Tor, short for The Onion Router, is free and open-source software for enabling anonymous communication. The torify command can be used to run any command through tor.

Tor aims to conceal its users’ identities and their online activity from surveillance and traffic analysis by separating identification and routing. It is an implementation of onion routing, which encrypts and then randomly bounces communications through a network of relays run by volunteers around the globe. These onion routers employ encryption in a multi-layered manner (hence the onion metaphor) to ensure perfect forward secrecy between relays, thereby providing users with anonymity in a network location. That anonymity extends to the hosting of censorship-resistant content by Tor’s anonymous onion service feature. Furthermore, by keeping some of the entry relays (bridge relays) secret, users can evade Internet censorship that relies upon blocking public Tor relays.

Because the IP address of the sender and the recipient are not both in cleartext at any hop along the way, anyone eavesdropping at any point along the communication channel cannot directly identify both ends. Furthermore, to the recipient it appears that the last Tor node (called the exit node), rather than the sender, is the originator of the communication.

If you want to access “dark web”, you need to install Tor service.

Let me assuming you’re using Linux, you can type the following command in the terminal to install Tor:

sudo apt install tor

Check if Tor Service is running:

service tor status

If Tor Service is not running:

service tor start

Next, edit /etc/tor/torrc (you can use any text editor of your choise like vim, pluma, vi etc.):

sudo gedit /etc/tor/torrc

Find the line containing the following:

#ControlPort 9051 …and uncomment it.

Next, find the following line:

#CookieAuthentication 1

Uncomment it, and change 1 to 0.

Finally, restart the tor service:

service tor restart

Now, Check your current public IP address:

curl ifconfig.me

…and compare the result to the following:

torify curl ifconfig.me 2>/dev/null

The torify command can be used to run any command through Tor. The redirect to /dev/null is used because torify sometimes generates warnings on some platforms.

After running the above command you should see your anonymous IP address hidden by Tor. Restart the tor service again if you can't see a different IP.

Now, you’re ready to perform whatever tasks you need to from the shell, via Tor.

If you want to force Tor to generate a new circuit, and thus a new IP, use the following command:

echo -e 'AUTHENTICATE ""/r/nsignal NEWNYM/r/nQUIT' | nc 127.0.0.1 9051

After sending the NEWNYM signal, use this command to get a new IP address:

torify curl ifconfig.me 2>/dev/null
Ivan Das