Hack and / - Lightning Hacks--SSH Strikes Back
A lesser-known feature of SSH is that you can enter an internal command-line mode in an existing session and add extra tunnels. Let's say you already have an SSH session open from admin1 to londonweb1, and now you want to add the reverse tunnel without having to log out. First, press ~C (that's the ~ character and then a capital C) to open the SSH command line. Then, you can add extra port-forwarding commands as though they were part of the original SSH command line. When you are done, simply press Enter to return to the regular shell:
kyle@londonweb1:~$ ssh> -R 2222:seattleweb1:22 Forwarding port. kyle@londonweb1:~$
This also could be useful if you use regular SSH tunnels (the -L option) as a poor-man's VPN and realize that, for instance, you need to set up an extra VNC or RDP tunnel to a new server. When you use the SSH command line, you won't have to close and break any existing sessions you have.
Kyle Rankin is a Systems Architect in the San Francisco Bay Area and the author of a number of books, including The Official Ubuntu Server Book, Knoppix Hacks and Ubuntu Hacks. He is currently the president of the North Bay Linux Users' Group.
Kyle Rankin is a VP of engineering operations at Final, Inc., the author of a number of books including DevOps Troubleshooting and The Official Ubuntu Server Book, and is a columnist for Linux Journal. Follow him @kylerankin.
|Daily Giveaway - Fun Prizes from Red Hat!||Oct 25, 2016|
|Installing and Running a Headless Virtualization Server||Oct 25, 2016|
|Ubuntu MATE, Not Just a Whim||Oct 21, 2016|
|Non-Linux FOSS: Screenshotting for Fun and Profit!||Oct 20, 2016|
|Nasdaq Selects Drupal 8||Oct 19, 2016|
|Canonical Ltd.'s Ubuntu Core||Oct 19, 2016|
- Installing and Running a Headless Virtualization Server
- Daily Giveaway - Fun Prizes from Red Hat!
- Daily Giveaway
- Ubuntu MATE, Not Just a Whim
- Nasdaq Selects Drupal 8
- Build Your Own Raspberry Pi Camera
- Secure Desktops with Qubes: Compartmentalization
- Canonical Ltd.'s Ubuntu Core
- Polishing the wegrep Wrapper Script
- Non-Linux FOSS: Screenshotting for Fun and Profit!