This approach sets Tor Browser as default browser for a single user. It also makes Tor Browser open a new tab when a link is opened from the operating system.
As a single script
This script should have the same effect as manually following the instructions below it. For execution it needs the environment variable TOR_BROWSER_PATH
set to your PATH/TO/tor-browser_LANG
.
#!/bin/bash
set -e
set -x
mkdir -p ~/.local/share/applications
cat > ~/.local/share/applications/torbrowser.desktop << EOF
[Desktop Entry]
Type=Application
Name=Tor Browser
GenericName=Web Browser
Comment=Tor Browser is +1 for privacy and -1 for mass surveillance
Categories=Network;WebBrowser;Security;
Exec=$(realpath "$TOR_BROWSER_PATH")/Browser/start-tor-browser --detach --allow-remote %u
Icon=$(realpath "$TOR_BROWSER_PATH")/Browser/browser/chrome/icons/default/default128.png
StartupWMClass=Tor Browser
MimeType=x-scheme-handler/unknown;x-scheme-handler/about;x-scheme-handler/https;x-scheme-handler/http;text/html;
EOF
update-desktop-database ~/.local/share/applications
xdg-settings set default-web-browser torbrowser.desktop
mkdir -p ~/.local/bin
cat > ~/.local/bin/firefox << 'EOF'
#!/bin/bash
/usr/bin/firefox --no-remote "$@"
EOF
chmod u+x ~/.local/bin/firefox
if ! (echo "$PATH" | tr ":" "\n" | grep ~/.local/bin); then
cat >> ~/.profile << 'EOF'
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
EOF
fi
You may need to log out and log in from your Linux to make the settings apply.
Manual configuration
Set up Tor Browser
Open up the terminal application. Then type or copy&paste the following commands into the terminal:
mkdir -p ~/.local/share/applications
gedit ~/.local/share/applications/torbrowser.desktop
Insert the following into the editor which opened up:
[Desktop Entry]
Type=Application
Name=Tor Browser
GenericName=Web Browser
Comment=Tor Browser is +1 for privacy and -1 for mass surveillance
Categories=Network;WebBrowser;Security;
Exec=PATH/TO/tor-browser_LANG/Browser/start-tor-browser --detach --allow-remote %u
Icon=PATH/TO/tor-browser_LANG/Browser/browser/chrome/icons/default/default128.png
StartupWMClass=Tor Browser
MimeType=x-scheme-handler/unknown;x-scheme-handler/about;x-scheme-handler/https;x-scheme-handler/http;text/html;
Replace PATH/TO/tor-browser_LANG
by the appropriate path.
Save the file and close the editor. Then run the following commands in the Terminal:
update-desktop-database ~/.local/share/applications
xdg-settings set default-web-browser torbrowser.desktop
Finished! You should now have Tor Browser in your launcher menu.
Try to open a link from the Terminal with the following command. It should now open in Tor Browser. Make sure no other standard-Firefox windows are open before.
xdg-open "https://askubuntu.com"
Coexistence with standard Firefox
As Tor Browser uses a modified Firefox under the hood, and Firefox tries to run as a single instance, links could now open in an already running Firefox instance instead of Tor Browser. To work around this, we need to ask the standard Firefox to not accept remote commands.
In the terminal, run these commands:
mkdir -p ~/.local/bin
gedit ~/.local/bin/firefox
Paste this into the editor:
#!/bin/bash
/usr/bin/firefox --no-remote "$@"
Save and close, then run these commands:
chmod u+x ~/.local/bin/firefox
echo "$PATH" | tr ":" "\n" | grep ~/.local/bin
If the last command did have a (bold red) line containing .local/bin
as output, you have finished here. If not, run the following:
gedit ~/.profile
Add this to the end of the file, save, and close:
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
You may need to log out and log in from your Linux to make the settings apply.
The only restriction I found with this approach is, that it is not possible to open new tabs in a running standard Firefox instance from outside of Firefox then.
System-wide installation
System-wide installation of Tor Browser is not recommended for privacy reasons (not quite sure).