I have an Ubuntu server example.com
and I have ssh'ed into it. But only after I ssh into it, do I realize that I meant to do ssh -L 8000:localhost:9000 example.com
. Is there a way to create that tunnel in an already established and running ssh connection?
Asked
Active
Viewed 3,255 times
4

Alexander Bird
- 38,679
- 42
- 124
- 159
-
So, you have an ssh session open. Then, if you tunnel, you'll create another one. You're asking if you can have the tunnel connect to your existing session and replace it? Presumably to keep your session running? ... also, why do you want to tunnel if you can just ssh in directly? – John Hinnegan Mar 06 '11 at 16:01
-
@John: tunnel is very useful to bounce arbitrary protocols over SSH. I mostly bounce RDP. – Joshua Mar 06 '11 at 16:12
-
Belongs on http://serverfault.com – Paul R Mar 06 '11 at 17:08
1 Answers
8
If you set your escape character with EscapeChar option in ~/.ssh/config or with the -e option you can.
Assuming an escape of ~: ~C-L 8000:localhost:90000 will do it.

Joshua
- 40,822
- 8
- 72
- 132