A Practical Guide to SSH Tunnels: Local and Remote Port Forwarding
179 points - last Saturday at 3:55 AM
SourceComments
So, if you use SSH tunneling to forward a port from localhost to a remote, then Docker unwittingly pushes to a remote. This is super useful "off the grid" with robotics/embedded applications where you don't want to bother with a registry and a good Internet connection.
Example, docker pussh: https://github.com/psviderski/unregistry
"~C" will drop you into the SSH command line, allowing you to, among other things, effect port forwarding
-L8080:localhost:443
Learning that "~C" exists, and what you can do with it, has supercharged my use of SSH tunnels, which were already awesome on their own.But for some reason this has been disabled by default in more recent ssh configurations... to ensure its available
-o EnableEscapeCommandline=yes
or, in your ~/.ssh/config EnableEscapeCommandline yes
(edit: formatting)Goes over similar content as TFA, in perhaps a little more depth. Indispensable sysadmin knowledge.
ssh -J user1@bastion1,user2@bastion2 targetuser@targethost
Edit: Jumphosting was introduced in OpenSSH 7.3 2016-08-01.The socks proxy support can also deal with bad web filtering and privacy issues on public wifi networks (though nowadays if you're ssh'ing to a cloud IP, you'll get lots of "bot" restrictions).
It's amazing how lightweight this method actually is. I have managed to connect hundreds of devices using a single EC2 nano instance.
Why is that?
Can’t I just open up a harness and prompt “Teach me how to do X?”