this post was submitted on 18 Nov 2025
2 points (100.0% liked)

ShareGPT

88 readers
1 users here now

To share LLM text output that others might find interesting.

founded 2 years ago
MODERATORS
 

You can use torsocks on Arch Linux to transparently route most CLI applications through the Tor network, effectively using it as a proxy wrapper. Below is a concise, operational guide.


1. Install and Enable torsocks

sudo pacman -S torsocks
sudo systemctl enable --now tor.service

Confirm Tor is running:

systemctl status tor.service

2. Basic Usage

You prepend any command with torsocks:

torsocks curl https://check.torproject.org/
torsocks git clone https://github.com/...
torsocks ssh user@example.com

torsocks checks /etc/tor/torsocks.conf and defaults to the local Tor SOCKS port at 127.0.0.1:9050.


3. Optional: Enforce torsocks Globally in a Shell

You can alias commands during a session:

alias curl="torsocks curl"
alias wget="torsocks wget"

Or start a shell where everything runs through torsocks:

torsocks bash

Anything executed inside that subshell will use Tor unless explicitly excluded.


4. Configuration Options

Configuration lives at:

/etc/tor/torsocks.conf

Key parameters include:

  • TorAddress (default 127.0.0.1)
  • TorPort (default 9050)
  • OnionAddrRange
  • AllowInbound 0|1

Example modification (if Tor is running on 9150, as in Tor Browser Bundled Tor):

TorPort 9150

Restart not required; torsocks reads this on invocation.


5. When torsocks May Not Work

torsocks only hooks dynamically linked network calls, so:

  • Statically linked binaries may bypass it entirely.
  • Applications using custom network stacks may not be compatible.
  • Some protocols (e.g., certain UDP-heavy ones) will not function through Tor.

To test whether it is working, run:

torsocks curl https://ifconfig.me/

You should receive an exit IP belonging to a Tor exit node.


6. Hardening Tips

  • Avoid using Tor with applications that leak DNS. torsocks handles DNS via Tor, but only if the application uses libc resolver functions.
  • Avoid protocols that expose your real IP within the protocol (e.g., BitTorrent).
  • Avoid logging that could inadvertently store local IPs.

If you want, I can also provide:

  • A system-wide transparent Tor proxy approach (iptables + tor + transproxy)
  • A minimal torsocks wrapper script for specific applications
  • Troubleshooting steps for common compatibility failures
no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here