4

I'm trying to set up a Tor relay on Debian Jessie. I edited the torrc file and set RunAsDaemon 1. When I try to start tor with sudo tor it returns this:

[warn] /var/lib/tor is not owned by this user (root, 0) but by debian-tor (110). Perhaps you are running Tor as the wrong user?
[warn] Failed to parse/validate config: Couldn't access/create private data directory "/var/lib/tor"
[err] Reading config failed--see warnings above.

How can I fix it?

4
  • It seems to work now. I entered "sudo service tor restart" Screenshot: www2.pic-upload.de/img/33235701/…
    – Stéphane
    Commented May 27, 2017 at 9:50
  • You should control Tor through the service interface, running it directly from the command line with sudo tor will cause problems like those you saw, also RunAsDaemon 1 isn't required but it's overridden by the launched service anyway (if you did enforce runasdaemon it would break the tor service) but you probably want to kill the instance of tor that's running as root: sudo kill 5184
    – cacahuatl
    Commented May 27, 2017 at 22:56
  • 5184 is the "top" process. Was "service restart tor" the correct command? What do you mean by enforce ruasdeamon?
    – Stéphane
    Commented May 30, 2017 at 20:14
  • Basically the problem was you still had a copy of tor running as root, which may have interfered with the tor service, if it's not there anymore then this should be resolved.
    – cacahuatl
    Commented May 30, 2017 at 22:38

1 Answer 1

1

The first line of the warn message has some hints. The directory /var/lib/tor is owned by the user debian-tor. You executed sudo tor which means that the Tor process is run by the root user. This leads to the error message.

You can either execute the command as debian-tor user:

sudo -u debian-tor tor

or start the process via systemd (or similar means):

sudo systemctl start tor
sudo service tor start
2
  • Tor is working now. I entered this in the shell: service tor restart
    – Stéphane
    Commented May 30, 2017 at 20:16
  • 2
    N.B. that simply using sudo -u debian-tor tor won't provide the same functionality because it doesn't load up the torrc-defaults file to set some default settings, however it will use the settings from /etc/tor/torrc
    – cacahuatl
    Commented May 30, 2017 at 22:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .