Tor service on Linux

11 May 2023 8 minutes Author: Lady Liberty

Tor browser in Linux distributions

Tor browser is the most secure and encrypted web browser for routing traffic and using the Internet in a private network. Most people use the Tor browser to hide their digital footprint and identity. Tor can take you to websites that are blocked or banned by your ISP or government. Using Tor is completely safe and it does not send your personal browsing data to an authority. The Tor browser is compatible with Linux, Windows and Android phones. Installing Tor on your system can keep it hidden, but since the IP address visits many unknown Tor servers before reaching the final server, it can also make your connection slower. The Tor browser is based on the Firefox web browser and is written in the Python and C programming languages.

It is built under the Tor project and has a BSD 3 license. Tor connects your ISP’s signal to the tor network, where no one knows which node is connected to which node; therefore, it is virtually impossible to trace your identity on Tor. Tor is available for Ubuntu and other Linux distributions. This post will show you how to install and get started with the Tor browser on different Linux operating systems. No one can deny that Tor is the safest browser to browse the Internet anonymously. If privacy is your biggest concern, then Tor is for you. Hiding your identity under a chain is probably the most reliable method in the Internet age. I have described different methods to install the Tor browser and get started with it on a Linux machine throughout the post. Please share it with your friends and the Linux community if you find this post useful and informative.

How to install Tor on Linux

The Tor package is available in most Linux distributions and can be installed from standard repositories. Installing Tor in Debian, Linux Mint, Ubuntu, Kali Linux and their derivatives:

Installing Tor in Arch Linux, BlackArch and their derivatives:

No configuration is required to run Tor – the program already has default values for the options. However, you can change a lot of Tor’s behavior through command line options and directives in the configuration file.

How to start the Tor service

To start, use the command:

To check the status:

To add the Tor service to the startup so that it starts every time you turn on your computer:

To stop the Tor service:

To remove from autoload:

How to run tor service without translation in the background

The above methods of running tor turn it into a daemon – that is, a process that runs in the background and is disconnected from the console. If you need to keep the Tor service out of the background for debugging purposes, for example, and can close it with CTRL+c, then start the Tor service as follows in Debian and derivatives:

In Arch Linux, BlackArch and derivatives, the launch is performed as follows:

In fact, the tor program does not need superuser privileges. However, the service requires files and directories (/var/lib/tor) which are not accessible to all users (even root) and which belong to the user debian-tor or tor (the username depends on the distribution). Therefore, sudo is used with the -u option, followed by the name of the user on whose behalf the command is executed. An example of running tor without demonetization:

Lines containing the word Bootstrapped show the progress of the connection to the Tor network. When everything is ready for the full exchange of information with the Internet via the Tor network, it will be released:

Tor settings files

The main configuration file for the Tor service is /etc/tor/torrc. This file contains only comments, i.e. it does not set any parameters by default. The Tor service provides default values for all settings. For this reason, the file is optional – if it is missing, the Tor service will still start. If the /etc/tor/torrc file is not found, an attempt will be made to find the $HOME/.torrc file. If this file is not present either, Tor will simply continue downloading.

There is another configuration file with default settings: /etc/tor/torrc-defaults. The idea is that it should contain defaults that can be overwritten by /etc/tor/torrc or $HOME/.torrc. But in practice, this file even comes with the Tor package. Next, let’s look at a few options related to configuration files. These options can be specified when starting the service with the tor file.

Check the Tor configuration file for correctness. Startup depends on the tor username on the system:

Or this:

Specifies a new configuration file containing further Tor configuration options. If – (dash) is specified, the options will be read from standard input. Default is /etc/tor/torrc or if this file is not found then $HOME/.torrc).

Do not require the configuration file specified by the -f option to exist if the default torrc can be accessed).

–defaults-torrc FILE
Specifies the file where to look for defaults for Tor options. The contents of this file are overwritten by the usual configuration files and command line options (/etc/tor/torrc-defaults by default).

Specifies that Tor should treat the missing torrc file as if it were empty. Tor usually does this because there are no default Torrc files, but not for files specified on the command line.

Setting up Tor logs

Tor logs are configured in the configuration file using the Log directive. This directive consists of three components:

Tor logs are configured in the configuration file using the Log directive. This directive consists of three components:


  • stderr — standard error output
  • stdout — standard conclusion
  • syslog — system junral (only for Unix)
  • file FILE_NAME – saving the log to a file.

For example, to output a notice-level message to standard output, you need to write it like this:

To output messages from the info level to the err level to the tor.log file, you need to write the following directive to the configuration file:

The Log directive can be specified several times.

How to start Tor service with options

Tor has many options that have default values. These values can be changed in Tor configuration files, which are described in the next section. In this case, you can run the service on the command line with the options that are used in the configuration file, for this use the command type:

Since in most cases you want to run the service as the user debian-tor or tor, the commands should be something like this (for Debian and derivatives):

In Arch Linux, BlackArch and derivatives, the launch is performed as follows:

An example of starting the Tor service with options to replace their values from the configuration file:

If the VALUE for an OPTION consists of more than one word, or includes special characters, it must be enclosed in quotation marks, for example:

See the rules for rewriting or adding option values. in the next section.

How to view Tor logs

You can view Tor logs in different ways, one of the options:

Please note that if you have Debian or a derivative of this distribution, you need to specify the user debian-tor instead of tor, for example:

For example, to display the last 100 records:

You can also view Tor events with:

or with:

How to use the Tor service on Linux

Once Tor is running on your computer, the SOCKS proxy becomes available. If you do not know what it is, it is recommended to read the article “All about proxies: types, how to use, how to check the quality of proxies”.

This proxy is available on IP address and port localhost:9050. Remember that some applications have their own proxy settings and may ignore the system-wide settings:

Remember that you need to specify localhost as the IP address and 9050 as the port number. Many programs can work with SOCKS4 and SOCKS5 directly:

Compare with the conclusion:

If the program supports only HTTP/HTTPS proxies, but cannot work with SOCKS, then use Privoxy or ProxyChains-NG as a mediator.

Solving problems with Tor

Ошибка «Could not bind to Address already in use. Is Tor already running?»

If you encounter errors “Could not bind to …: Address already in use.”, for example:

This means that the ports Tor is trying to listen on are already occupied by another process, possibly another running Tor instance. To remedy this situation, stop another instance of the tor service or find an application that occupies that port.

Error «Directory /var/lib/tor cannot be read: Permission denied»


It occurs when the tor process does not have rights to access the /var/lib/tor folder. You need to run the tor process as the appropriate debian-tor or tor user as follows:

Error “/var/lib/tor is not owned by this user”

If such errors occur:

This means that you are running Tor as root, and you need to run as the user debian-tor or tor as follows:

Other related articles
Found an error?
If you find an error, take a screenshot and send it to the bot.