SSH Tunnels: My VPN Alternative for Privacy on the Go

2 hours ago 1

Home - About

By Joel Dare - Updated September 2, 2025 - Written June 1, 2020

With a single command I’m able to secure my connection, protect my privacy, and get back to building.

I first learned about SSH tunneling from a co-worker when we were trying to get work done on a restrictive wifi network. VPNs aren’t always an option. But SSH was already there. It felt like a hidden shortcut and it worked great.

If you have access to a Linux server, you can use SSH to create a secure “tunnel” between your machine and another. In this case, I used a virtual private server (VPS) I already had running on a server in San Francisco.

My traffic is encrypted and sent through the tunnel, which has lots of advantages. It will encrypt data transmitted over a public WiFi connection to help prevent spying. It can get around certain network rules and firewall configurations. It can also hide your IP address (using the machine you SSH into instead of your local IP).

Because SSH includes a socks proxy, it’s very easy to setup in your web browser.

Here are the simple steps:

  1. Open the SSH connection via SSH
  2. Configure the web browser
  3. Optionally, make the SSH connection silent

Open the SSH Connection via SSH

First, open an SSH connection to the server you want to filter your traffic through. Here’s the command to make the connection.

ssh -D <port> <user>@<host>

Assuming I want to create a socks proxy at port 8080 on my local machine and I want that traffic filtered through my own user account (joel) on my VPS (23.220.75.245), I might run the following command.

ssh -D 8080 [email protected]

If I haven’t setup keys, SSH will ask for a password and log me into the system normally. It will also setup a SOCKS proxy. Now, I need to configure my browser.

Configure the Web Browser

Google Chrome and Safari both user your system proxy settings while Firefox has the option to use either the system proxy (default) or configure it manually.

If you’re not sure where to look for your system proxy settings, Google Chrome will provide you with a link. Do the following to get to those settings:

  • Menu (three dots), Settings
  • Search for “Proxy”
  • Click on “Open your computer’s proxy settings”

Once you’re in your computer’s proxy settings set the following values:

  • Enter “localhost” as the server
  • Enter “8080” as the port

Now browse the web. Use an IP lookup site (such as http://www.whatismyipaddress.com) to see if you’re browsing through the SSH connection. You should see the IP address of the server you connected too via SSH. In my example above, that’s 23.220.75.245.

Note: Make sure you put localhost under the SOCKS Host and not under HTTP Proxy.

Optional: Make the SSH connection silent

If you don’t want to execute a command (such as a shell) you can use the -N option in SSH. If you’ve setup SSH keys for the server you can also use & to execute the process in the background. Your new command might look like the following.

SSH -N -D 8080 [email protected] &

Build your next site in pure HTML and CSS

Want to build your next site in pure HTML and CSS? Join the free Five-Day Neat Starter Email Course and build a lean, production-ready page before Friday.

Email Me the Crash Course


JoelDare.com © Dare Companies Dotcom LLC

Terms - Privacy

Read Entire Article