SOCKS proxy using ssh (with i3 integration)

Bourne Again SHell

From time to time, thanks to geoblocking or IP address based authorization, you need to access websites through a proxy.

If you have access to a machine that would have the right address range or region, an easy and straightforward way is to use ssh:

$ ssh -N -D 8180 <desired_machine> &

i3 integration

If you need this proxy more frequently and you want to have the status of the proxy connection displayed in your i3-status line (from the window manager i3wm), then you can integrate the proxy with the following scripts:

Create a script to start the proxy connection, e.g. desired_machine_proxy.sh:

#!/bin/bash
PORT=8180
HOST=<host>
PID_FILE=/home/<user>/.i3/desired_machine_proxy.pid

rm -f $PID_FILE

ssh -N -D $PORT $HOST &
PID=$!

echo $PID > $PID_FILE

Then, update the i3status config in ~/.config/i3status/config:

...
order += "run_watch proxy"
...
run_watch proxy {
        pidfile = "/home/<user>/.i3/desired_machine_proxy.pid"
}
You have another opinion?
Great! Then let's reduce the fallacy together!

   

Why are there no comments?