When I try to install tor without sudo, using apt install tor Ubuntu 20.04 returns:

E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

When I install it with sudo apt install tor it works.

When I try to run it without sudo, using tor start, it returns:

[warn] Command-line option 'start' with no value. Failing.
[err] Reading config failed--see warnings above.

When I run it with sudo, using sudo tor start, it works and returns:

[warn] You are running Tor as root. You don't need to, and you probably shouldn't.


How can I ensure I am able to run tor without sudo? I think I should add permissions of the user-account to some group for tor, but I did not yet exactly find out how.


It's a normal error: the dpkg needs to obtain a global and system-wide lock to be sure that no installation process will mess one another, so they will be done in a serial way being run one by one. It's also true for any mainstream package manager like yum, rpm et cetera. It's OK to do a sudo for install: the installation script will create a separate isolated user for Tor and the config will drop the privileges just to it, so it's not a security hole at all

  • I do not quite understand what you mean with the config will drop the priviliges just to it. Your answer slightly confuses me because my observations imply that, given the sudo install, tor still requires the sudo privilege to run (without errors). That seems to suggest, to me, that the privileges have not been “dropped enough”. (I am talking about the privilege that is acquired by prepending sudo to command tor. (I assume that is some form of a privilege)).
    – a.t.
    Jul 30 '21 at 14:50
  • Tor has it's options for data directory and for a user to switch to. If you have not specified them - then yes, you will still need a sudo to start it. Otherwise you will need to sudo the systemctl start tor command to actually start the system-wide service. The tor itself will drop it's privileges to it's user - check the top command output
    – Alexey Vesnin
    Jul 31 '21 at 7:20

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.