Proxy Chrome via SSH

SSH can be used as a poor men's VPN for applications that support SOCKS.

This approach does not substitute a proper VPN! But it might come in handy in some occasions:

  • when VPN is not available / accessible
  • to circumvent regional IP blocks
  • to test your own IP-based redirects (and blocks)

Set up SSH Proxy

ssh -D8080 -N -fn

This command will open a SOCKS server on (local) port 8080, but not open a shell (-N) and go into background (-fn) immediately. Default settings from ~/.ssh/config will of course be applied.

The connection can be ended with kill.

Chromium / Chrome

Chromium has CLI options to configure a SOCKS proxy. Unfortunately it is not possible (at the moment) to configure this with a GUI.

chrome --proxy-server="socks5://localhost:8080" --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE myproxy"
Without the --host-resolver-rulesoption, Chromium might not use the Proxy for some non-HTTP requests (like DNS). More details can be found on the Chromium Wiki.

Multiple independent Chromium instances can also be started at the same time (possibly using different proxies) with --user-data-dir.

chrome --user-data-dir=/tmp/chromium-8080 --proxy-server="socks5://localhost:8080" --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE myproxy" --incognito

The --incognito option will remove the temporal user data directory when the instance is closed.

No Comments yet

Respond to this post