Logo

Lyle Backenroth header image 2

SSH: On the fly port forwarding.

January 26th, 2009 · No Comments

Once inside an SSH session, you may realize that you need to reach another box via the local port redirect (-L 1234:192.168.0.5:23 for example).

Most people think you need to kill your SSH session to add a new -L option, then reinitiate the SSH session; this is NOT true.

You can open an internal SSH shell within an SSH session to add new redirects!

From within an SSH session, simply type:

~# then hit <enter>

~C then hit <enter>

Then type: help and <enter>

You’ll see a listing of available commands. To add a new local redirect, just type

-L 4567:192.168.0.12:5900, then hit <enter>

…and voilà, you’ve added a new local redirect. Just hit <enter> once, and you’ll be dropped back into command line.

There are other escape-commands. Just type ~? from within an SSH session for more escape-commands.

FYI: This also works for remote redirects, as well.

Here’s a Google search link offering more info:

Tags: Blogroll

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

You must log in to post a comment.