20

I am trying to connect to TOR via telnet in my terminal on my mac osx and to request new identity, but it is not working, I always get this error message:

Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host

I am using this telnet command for the connection:

telnet 127.0.0.1 9051

And idea why is this not working?

thx

1
20

The fastest and easiest way to get "new identity" is send HUP signal.

Tor daemon re-read configurations files and make "new identity".

I keep special bash script for this:

# cat /usr/local/bin/nym 
#!/bin/bash
pidof tor | xargs sudo kill -HUP

My sudoers file full of NOPASSWD:

# cat /etc/sudoers 
....
anonymous       ALL=(ALL) NOPASSWD: ALL
...

Try this.

2
  • 7
    Instead of pidof tor | xargs sudo kill -HUP why not just do killall -HUP tor? Jan 13 '14 at 14:02
  • @MathiasBynens I'm not the OP, but in some docker containers killall isn't installed
    – alexyorke
    Aug 19 '20 at 1:18
12

Have you set a control port in your torrc? To make it available via telnet you will need "ControlPort 9051". After that you will want to give tor a NEWNYM signal...

$ telnet localhost 9051
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
AUTHENTICATE
250 OK
SIGNAL NEWNYM
250 OK

You can do this via a script using stem with...

from stem import Signal
from stem.control import Controller

with Controller.from_port(port = 9051) as controller:
  controller.authenticate()
  controller.signal(Signal.NEWNYM)

Thanks for the question! I've added it to stem's faq.

1
  • 2
    If you're using the Tor Browser Bundle you don't need to set a control port, it is already set to 9151.
    – deweydb
    Nov 19 '14 at 0:23
0

For ubuntu users, who have been kicked here by google search engine xD :

$ test your current IP
$ curl -sx socks5://127.0.0.1:9050 ifconfig.co | grep -oP '(?<=Your IP</span>: ).*(?=</span>)'
185.220.100.255

$ to get new NYM just restart TOR service
$ sudo service tor restart

$ but remember a new NYM is not always is a new IP, so check your IP again and redo step 2 if it is the same one
$ curl -sx socks5://127.0.0.1:9050 ifconfig.co | grep -oP '(?<=Your IP</span>: ).*(?=</span>)'
185.220.101.214

Your Answer

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