I have an established ssh tunnel (port 9876) that is running in the background and was established with this command:
/usr/bin/autossh -M 0 -o ServerAliveInterval 30 -o ServerAliveCountMax 3 -D 9876 email@example.com -i /path/to/keyfile -T -N -n
Let's say I cannot change anything about it. I can utilize the tunnel from applications like Firefox by specifying a socks5 proxy on
localhost on port 9876.
My question is how can I utilize that existing tunnel from another bash shell?
I know of some specific tools allow using a local proxy in this way, such as curl:
curl -sS -x socks5://127.0.0.1:9876 icanhazip.com
However, I am interested in the general question of how to make any Internet connection from a bash shell utilize this existing ssh tunnel, without relying on a program to have that feature. Is it possible?