I am trying to open a control port on tor with the following command:

sudo -u debian-tor tor --CookieAuthentication 0  --ControlPort 9050 --SocksPort 50001

but it will only stay open for 5 or so seconds before closing. Is there any way to fix this? Logs (these are from when I first run the command):

Jan 02 18:37:54.600 [notice] Tor running on Linux with Libevent 2.1.8-stable, OpenSSL 1.1.1d, Zlib 1.2.11, Liblzma 5.2.4, and Libzstd 1.3.8.
Jan 02 18:37:54.600 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Jan 02 18:37:54.601 [notice] Read configuration file "/etc/tor/torrc".
Jan 02 18:37:54.611 [warn] Linelist option '__HashedControlSessionPassword' has no value. Skipping.
Jan 02 18:37:54.612 [warn] ControlPort is open, but no authentication method has been configured.  This means that any program on your computer can reconfigure your Tor.  That's bad!  You should upgrade your Tor controller as soon as possible.
Jan 02 18:37:54.619 [notice] Opening Socks listener on
Jan 02 18:37:54.619 [notice] Opened Socks listener on
Jan 02 18:37:54.619 [notice] Opening Control listener on
Jan 02 18:37:54.619 [notice] Opened Control listener on

torrc file: https://raw.githubusercontent.com/inyourface34456/torrc-file/main/torrc (i could not paste it in. i had to upload it to github)

  • Can you post the logs? It's probably because one of the ports is already in use.
    – Steve
    Jan 2 at 23:28
  • So tor exits immediately after those messages? Can you post your torrc file, and also run echo $? after tor exits? Do you have RunAsDaemon set anywhere?
    – Steve
    Jan 3 at 0:00
  • no, it exits in about 5 or so seconds after exacuting Jan 3 at 0:05
  • @Steve echo $? returns 1 and RunAsDaemon is set to 1 Jan 3 at 0:28
  • With RunAsDaemon 1, this behaviour (exiting after address binding) is expected. Can you check for tor processes running using ps aux | grep -i tor? There is likely a tor process running in the background.
    – Steve
    Jan 3 at 1:04

The answer was that RunAsDaemon was enabled in the torrc, which moves tor to the background once it has finished binding any listening sockets. You can find the background tor process using ps aux | grep -i tor.

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.