Chrome ssh tunnel forwarding

17

13

I am first logging into an ssh server. Then I am trying to use Chrome for ssh tunnel forwarding. Is there a gui way of doing this? I can do this in Firefox's gui in like 10 seconds so I would think Chrome would also have this useful feature. Is there an easier way to do this?

Linux
/usr/bin/chromium-browser --proxy-server="socks5://localhost:3145"

Windows
C:\Users\username\AppData\Local\Chromium\Application\chrome.exe --proxy-server="socks5://localhost:3145"

I found this by reading these two links.

cokedude

Posted 2014-10-02T08:16:37.220

Reputation: 349

What is your question? The only question I can see is the one you already answered your self? – tlund – 2014-10-02T09:43:06.813

1I was hoping chrome had a GUI method of this. The average user of chrome is not gonna know how to do this. GUI methods are usually easier to follow and do. I was also if there was an easier and shorter command line method of this. – cokedude – 2014-10-02T21:19:48.137

Answers

30

If you want to use a remote ssh server as a SOCKS5 proxy with Chromium, it is as easy as:

ssh -ND 1080 remote_server
  • -N: don't run a command: just make redirections/proxies
  • -D: set up a proxy server on local port 1080

Other possibilities:

  • -f: would fork immediately after successfully logging in and setting up the redirections
  • -C: would activate compression, which makes sense over slow or expensive (mobile, GPRS/3g/LTE) links.

and then:

chromium-browser --proxy-server="socks5://localhost:1080"

Remember to close every chromium windows first. Otherwise the proxy effect will not have any effect.

You might want to install the package "autossh" so that the connection is automatically reestablished upon disconnections. In this case, for sure you want to set up public key authentication so that you do not need to enter your password every time.

1080 is the standard port for a SOCKS server. Using standards helps other programmers understand and maintain your setups.

Raúl Salinas-Monteagudo

Posted 2014-10-02T08:16:37.220

Reputation: 1 058

2If you want to run an instance of your browser without tunneled traffic in parallell, you can add --user-data-dir=~/.config/mytunneldchrome when starting your tunneled chrome/chromium. – Tvartom – 2018-03-22T09:30:50.997