How to edit my sources.list to add Tor Debian Repository

Safest way to change the permissions of this file so that I can can configure tor package repository and add :

deb [signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org < Byzantium> main
deb-src [signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org < Bytzantium> main

to tor.list file I created in /etc/apt/sources list.d.

And received not a directory when trying to shift to it i tried to shift to the file in root as well. See pictures

sudo echo "deb [signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org byzantium main" > /etc/apt/sources.list.d/tor.list
sudo echo "deb-src [signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org bytzantium main" >> /etc/apt/sources.list.d/tor.list

This should add those lines to /etc/apt/sources.list.d/tor.list. However! “byzantium” is not a dist supported by deb.torproject.org, so it will not work. According to this article, byzantium is based on debian bullseye, so changing byzantium to bullseye above, may work, no guarantees.

2 Likes

One sideways carrot or two sideways carrots .

If you mean >: 1 overrides a file, removing what was in it before, so it is fine to use just one for the first line/echo, but for the second we don’t want to remove the first line we just added, so we have to use 2.

precisely nothing occurred did i do something wrong

You did not add >> /etc/apt/sources.list.d/tor.list, and so it just printed the lines out on the terminal. Also it is bullseye not <Bullseye>:

sudo echo "deb [signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org bullseye main" >> /etc/apt/sources.list.d/tor.list
sudo echo "deb-src [signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org bullseye main" >> /etc/apt/sources.list.d/tor.list

this link helped alot Install Tor on Debian

I was able to edit the file and add the entries but now im on step 3 and 4 and nothing seems to happen … Step 3

wget -qO- https: // deb.torproject. org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --dearmor | tee /usr/share/keyrings/tor-archive-keyring.gpg >/dev/null

…
Step 4

#apt update
#apt install tor deb.torproject.org-keyring

When redirecting output to a file for which you don’t have write permission, try using a command like echo 'content' | sudo tee /path/to/file instead of sudo echo 'content' > /path/to/file and echo 'content' | sudo tee -a /path/to/file instead of echo 'content' >> /path/to/file. If you don’t want any output, you can redirect it to null with something like echo 'content' | sudo tee [-a] /path/to/file > /dev/null.

The command to download and write the GPG key does not work because you are trying to write to a directory/file for which you do not have write permissions. Place a “sudo” in front of the “tee” and it should work.

The cheat sheet commands you liked are meant to be executed as root. You can temporarily become root by using su - or sudo su, and revert to normal by executing exit. You should also take care when running commands from the Internet. Up-to-date information for this topic is found at Why and how I can enable Tor Package Repository in Debian?.

1 Like