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 your external IP address.

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