Tor with browser and cli/ssh/git
Guide to installing- and using Tor with browser and cli/ssh/git

This guide was written for MacOS users. However, everything minus the installation sections should apply to Linux users as well. Use your preferred package manager to install the required packages.

Torbrowser

How to install, configure and use Torbrowser.

Installation

1
brew cask install torbrowser

Configuration

  1. Open torbrowser
  2. Click on the Tor icon to the left of the address bar
  3. Click on “Privacy and Security Settings…”
  4. Try High Security Level, and lower only when necessary

Usage

Just open and use Torbrowser.app.


Command-line

How to install, configure and use the command-line service- and utilities.

Installation

1
2
brew install tor torsocks socat
brew services start tor

Usage: Anonymous http requests via command-line

Simply prefix curl/wget commands with torify:

1
torify curl ifconfig.me

Usage: Anonymous ssh operations

Add configuration in $HOME/.ssh/config:

1
2
3
4
5
6
Host myhost
  HostName example.com
  User michael
  Port 22
  IdentityFile ~/.ssh/id_rsa
  ProxyCommand socat STDIO SOCKS4A:127.0.0.1:%h:%p,socksport=9050

Then ssh into the node using the new myhost entry:

1
ssh myhost

Usage: Anonymous git operations

Add configuration in $HOME/.ssh/config:

1
2
3
4
5
Host gh
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_rsa
  ProxyCommand socat STDIO SOCKS4A:127.0.0.1:%h:%p,socksport=9050

Then add remotes using gh instead of github.com, for example:

1
2
3
4
git remote add origin ssh://gh/USER/REPO
# git pull origin master
# git push origin master
# etc

Notes

The ProxyCommand line in each ~/.ssh/config Host entry ensures that the ssh connection proxies through the Tor network. If the local tor service isn’t running, it won’t attempt to connect to the Host, so you can’t accidentally expose your location.

Commands prefixed with torify will fail if the local tor service isn’t running. This prevents you from accidentally exposing your location.

To start/stop the tor service: brew services <start|stop> tor.

To Archive →