1

User Image SSH Tunnel May 4, 2024, 10:14 p.m.

Here is to step by step how to create an ssh tunnel and bind browser on it:

1) Create a tunnel by using SSH Dynamic Port Forwarding


Assume that our remote ssh server's IP is 166.167.168.169 and the remote port is 2525 (default is 22)
Also i am using private-public key pair to communicate with my server.

We must run

ssh -q -C -N -D 9001 user@166.167.168.169 -p 2525&


-q: quiet

-C: compress

-D: Dynamic port (this will set our connection as socks proxy)

-N: tells ssh not to try reading a command from standard input which, being connected to /dev/null, would return EOF and thereby terminate the tunnel immediately.
& : means send process to background and bind the process to init (not ssh spesific)

Note: You must put this shell piece into a bash file and autostart with your desktop if you want to stay connected all the time

Now we have a socks proxy running on our local machine.

2) Now it is time to configure your browser:

You can connect to local socks server by adding a socks proxy in your browser's proxy configuration but i dont prefer that always. So I prefer to use that plugin to connect my server whenever I want.

Here is the link of plugin ->https://chromewebstore.google.com/detail/proxy-switcher/iejkjpdckomcjdhmkemlfdapjodcpgih

Now configure it as below and voila!



1