How to request new TOR identity in terminal

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.


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.