Add an SSH tunnel to an active session

By · · 1 min read · Tech, Tips

I need to establish SSH tunnels fairly regularly — most frequently when connecting to Windows hosts via a bastion.

Somewhat embarrassingly for years I have been changing the tunnel target by disconnecting and re-establishing my connection with the updated tunnel configuration.

I have recently discovered that it’s possible to add an SSH tunnel to an active session by doing the following:

  • Press [return]
  • Enter ~ and then C

You will then be given an ssh> command prompt. You can then add tunnels the same way as you would from the command line, eg: -L 13389: and pressing [return] to go back to your session.

I thought this was a tip worth sharing!