I want to Tor in terminal. This is what I used to do and it was working without any issue:
- running Tor Browser
- running
torify
ortorsocks
before the command in terminal
But it is for a while that this is not working. I don't remember if this is happening after some specific change in my system or not. I haven't had any major and noticeable change in it.
Perhaps the following lines can help for knowing the issue:
$ curl ifconfig.me
111.222.333.444 <<< My real IP
$ torify curl ifconfig.me 2> /dev/null
$ torify curl ifconfig.me
[Jan 21 20:55:05] PERROR torsocks[16007]: socks5 libc connect: Connection refused (in socks5_connect() at socks5.c:185)
$ torsocks curl ifconfig.me
[Jan 21 20:59:50] ERROR torsocks[16100]: Unable to resolve. Status reply: 4 (in socks5_recv_resolve_reply() at socks5.c:666)
curl: (6) Could not resolve host: ifconfig.me
While I'm facing this issue, I can easily use Tor Browser with no problem.
Any idea how to solve this issue?
Thanks
After spending lot of time and energy, I finally could manage to solve the problem myself.
It seems by default, Tor should be set in such a way to use the port 9050 for socks5. This setting can be found in
/etc/tor/torsocks.conf
file. Look at these lines in this file:Based on my TorBrowser setting, the browser uses port 9150 instead of 9050. So, I changed the relevant line and set 9150 as the port.
Now,
torsocks
andtorify
work as expected.(Just it seems there is some technical issue with ifconfig.me website, since I cannot open it even in browser. But other websites are working well.)
had this happen to me and also figured out what caused it: the tor port was left in a
close_wait
state after running a script with torify which means the port can't be opened for a short while so torify will not work until that port is released fromclose_wait