how can we get a different tor circuit with torify command in a separate terminal window? Specifically, if I type a command in a terminal 1 window
torify curl http://icanhazip.com
I receive my IP address in response.
but if I try it in another terminal window simultaneously I get the same IP which is a normal behavior.
what I am trying to achieve is to use a different config file in every new terminal window so as to get a different IP address in a different terminal window.
Advertisement
Answer
Use the -i
(--isolate
) option or --user
and --pass
to get stream isolation.
From man 1 torsocks
:
-u, --user Set username for the SOCKS5 authentication. Use for circuit isolation in Tor. Note that you MUST have a password set either by the command line, environment variable or configuration file (torsocks.conf(5). -p, --pass Set password for the SOCKS5 authentication. Use for circuit isolation in Tor. Note that you MUST have a username set either by the command line, environment variable or configuration file (torsocks.conf(5)). -i, --isolate Automatic tor isolation. Set the username and password for the SOCKS5 authentication method to a PID/current time based value automatically. Username and Password MUST NOT be set.
Example:
torify --user foo --pass password curl https://example.com/
Then, using a different set of credentials will get you a different circuit and exit relay:
torify --user foo2 --pass password2 curl https://example.com/
You can achieve the same using Tor’s socks proxy directly with curl, and specify a unique proxy username/password combination to get stream isolation as well.
Example:
curl -Lv --socks5-hostname 127.0.0.1:9050 --proxy-user foo:password https://example.com/
Then, using a different set of credentials will get you a different circuit and exit relay:
curl -Lv --socks5-hostname 127.0.0.1:9050 --proxy-user foo2:password2 https://example.com/