torify
Route network traffic through Tor
TLDR
Route traffic via Tor
Toggle Tor in shell
Spawn a Tor-enabled shell
Check for a Tor-enabled shell
Specify Tor configuration file
Use a specific Tor SOCKS proxy
Redirect output to a file
SYNOPSIS
torify
PARAMETERS
command
The command to run through Tor.
[arguments...]
Any arguments to pass to the specified command.
DESCRIPTION
torify is a shell script that wraps other commands to redirect their TCP and UDP traffic through the Tor network. It achieves this by setting environment variables, primarily LD_PRELOAD, to load a shared library (typically libtorify.so) that intercepts network calls and routes them via Tor's SOCKS proxy, usually running on localhost port 9050 (or 9150 for the Tor Browser Bundle). This effectively anonymizes the application's network communication, hiding the user's real IP address. Torify can be used with almost any network-aware application. However, it is essential to understand its limitations. It does not anonymize DNS requests by default unless configured appropriately. Also, applications that bypass standard networking libraries might not be torified successfully. The script attempts to handle different operating systems and configurations, though manual configuration may be needed in some cases. It requires that the Tor service be running and accessible for redirection to succeed.
CAVEATS
torify does NOT guarantee perfect anonymity.
DNS requests are often not proxied by default. Applications that directly use IP addresses (instead of hostnames) or bypass standard system libraries may leak your actual IP address. Always verify that traffic is routed through Tor using a tool like tcpdump before relying on torify for sensitive operations.
CONFIGURATION
The /etc/tor/torrc file (or equivalent system location) configures the Tor daemon. torify relies on Tor being properly configured and running for successful operation.
TROUBLESHOOTING
If torify doesn't work as expected, check the Tor logs for errors. Ensure Tor is running, and that the SOCKS proxy is accessible. Verify that libtorify.so is correctly loaded using ldd. Common problems include incorrect SOCKS port configuration, DNS leaks, and applications bypassing Tor.
DNS LEAKS
To prevent DNS leaks, you can configure torrc with options like DNSPort and AutomapHostsOnResolve. Tools like torsocks provide built-in DNS leak protection, but torify requires proper configuration.
HISTORY
The torify script has been developed and maintained within the Tor project to provide a simple way to route applications through the Tor network. Its usage has grown with the increasing need for online privacy and anonymity. It has evolved over time to support various platforms and handle different networking scenarios.