I have two machines: my laptop and a remote server. The server sits behind a firewall that only allows incoming ssh connections. I can use ssh on my laptop to login to the server without any issues.
Since I don't want to (can't) change the firewall, I'd still like to be able to run apt-get upgrade
and similar commands on the server, and thought that I could easily do the "reverse" of ssh -D 1234 user@remote
– ie change the -D
to something else so that I get a "reverse socks proxy" available on the remote end. (This I could later use, after setting up the right environment variables.)
Both machines run Ubuntu 15.04 and I'm using OpenSSH.
What command (or commands) should I issue in order to setup a tunnel with SSH, which has a proxy on my end (the laptop with internet access) and the remote server (which only accepts incoming tcp on port 22)?
Best Answer
OpenSSH 7.6 introduced reverse dynamic proxy as a native option. It is implemented entirely in the client, so the server does not need to be updated.