I have Machine A, which has internet access and has Tor running on port 9150. I have Machine B, which can't access the internet but can access Machine A via SSH. I want to run a command on Machine B (no internet machine); this command on Machine B accesses the internet. I want this command to go through Machine A port 9150. I don't have sudo access on Machine B, but I have sudo access on machine A.

How do I go about setting this up?


If Tor is listening on localhost only, use SSH local port forwarding from Machine B:

ssh user@machineA -L9150:localhost:9150

This will effectively bind port 9150 on Machine B to port 9150 on Machine A.

Or, if you can change the Tor daemon to listen on all interfaces on Machine A and no inbound firewall blocking this, you can ignore the SSH forwarding.

In either case, you can then use a tool such as proxychains, configured appropriately, to prepend your commands such that they go over Tor:

proxychains curl http://example.onion

Proxychains is likely available through your package manager, but a newer version exists on GitHub at https://github.com/rofl0r/proxychains-ng. The default configuration will try to connect to a Tor SOCKS server on localhost, but this can be changed by modifying proxychains.conf if necessary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.