4 ms·
Nice tip! One small problem: if I set .ssh/config to do the RemoteForward, if I open up two shells to the same host, the second shell complains that it can't s
by mjs 16y ago
Nice tip! One small problem: if I set .ssh/config to do the RemoteForward, if I open up two shells to the same host, the second shell complains that it can't set up the remote forward (because the first shell has already set it up). Of course it's not necessary for the remote forward to be established twice--is there any way to get the port forwarding set up once, and only once, for a given host?
- whimsy 16y agobnoordhuis posted a scriptable solution. You could write a wrapper script for SSH that passes arguments straight through, but first checks for your port forward. Or, just write a script that forwards the port and run it before you start working.
- JoachimSchipper 16y agoYou can get this as a side effect of multiplexing connections, see ControlMaster in ssh_config. Multiplexing connections also makes opening a second connection to the same host much faster, so it's usually worthwhile on its own. (Note that it's not perfect: in particular, the first connection to a host remains open until all collections have been closed. This is being worked on, IIRC.)