Persistent SOCKS-proxy using SSH on Linux in single line


In Linux you can simply use your remote host as SOCKS5-proxy. To do this run the following command in your terminal:

while true; do ssh ServerAliveInterval=60 -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -C2qTnN -D 1080 user@host; sleep 15; done

Then run in another terminal window:

curl --socks5-hostname

It should print external IP address of a remote host being used as a SOCKS proxy.

You can set up as SOCKS5-proxy in your favorite browser as well.