The OpenSSH client has a command line option for port forwarding, used like this:
ssh -L localport:server:serverport user@host
which will connect to
user, and at the same time redirecting
localport on the client to
server (which can be
host or anything reachable from
host over the network).
Now suppose I have SSHed into
host doing just
and in the middle of the session I realize I forgot to forward the port. Alas, I am in the middle of something, so I don’t just want to log out and re-establish the SSH connection with the port forwarding.
Is there a way to add port forwarding to a running SSH session?