I have been trying to restart tor (for the sole purpose of changing my IP address).

So what I did was make an alias to pkill -x tor; tor. But that gives me the usual tor is already in use/the ip address is already in use etc. indicating that I tried to start tor when it was already running.

I figured that the ; was at fault, because that doesn't care if the process has been killed or not so instead I used &&. But that did the same thing, first start tor, then kill it.

So I looked it up, and some people use something like sudo /usr/local/etc/init.d/tor, but the way I start it is by simply running the tor executable, and when I tried to do the init.d thing it just told me that the command doesn't exist (which is logical because it doesn't).

So what am I supposed to do?

Also, I have no init.d folder I also have no systemd.

  • 1
    I don't have tor on linux, however on windows you can renew your indentity (that is get a new adress), is there no such button on tor for linux ? – Archemar Feb 12 '15 at 14:17
  • try pkill -x tor ; sleep 30 ; tor . this should give some time for tor to stop before restarting. – Archemar Feb 12 '15 at 14:18
  • @Archemar (Im using OS X) But I'm not talking a GUI this is pure command line tor, not TorBrowser. – DisplayName Feb 12 '15 at 14:32

My answer is quoted from this stackoverflow question

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 
pidof tor | xargs sudo kill -HUP

My sudoers file full of NOPASSWD:

# cat /etc/sudoers 
anonymous       ALL=(ALL) NOPASSWD: ALL
  • Wouldn't sudo kill -HUP $(pidof tor) be slightly better? Less processes, etc. – jpmh Feb 3 '17 at 1:09

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.