betabug... Sascha Welter

home english | home deutsch | Site Map | Sascha | Kontakt | Pro | Weblog | Wiki

17 June 2008

Shell fun: escape ssh(1)

Hidden channels of communication

This shell fun post really needs a hat tip to kargig for his SSH Escape Characters post. I had read about ssh escape characters ages ago and never considered them very useful. kargig's post inspired me to experiment a bit more and finally (with a default setup that works for me and 2 nice use cases for me) I start to like those hidden beasts...

First of all, if you jack in to other servers using the default OpenSSH configuration, ~ is already set up as the default ssh escape character. But there is a trick to it: If you just press ~ while ssh-ing to another system, nothing happens. That is a Good Thing(TM), because otherwise I would get confused whenever I wanted to spy on Wu by typing cd ~wu. If you want to get into the "hidden ssh menu", you have to press "Return" (aka "Enter" for some people) first, then the tilde ~.

And voilà! So press Enter, followed by ~? and you will see this nice help menu:

kronos /home/betabug$ ~?
Supported escape sequences:
~.  - terminate connection
~B  - send a BREAK to the remote system
~C  - open a command line
~R  - Request rekey (SSH protocol 2 only)
~^Z - suspend ssh
~#  - list forwarded connections
~&  - background ssh (when waiting for connections to terminate)
~?  - this message
~~  - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)

The characters that form this output actually come from your local system. As kargig mentions, one he gets out of it is to terminate hanging sessions - I don't much have that problem (maybe I should start to use Linux too...), but I have two other nice uses for this stuff:

Which sometimes is a nice little time saver!

Posted by betabug at 18:47 | Comments (0) | Trackbacks (0)
ch athens
Life in Athens (Greece) for a foreigner from the other side of the mountains. And with an interest in digital life and the feeling of change in a big city. Multilingual English - German - Greek.
Main blog page
Recent Entries
Best of
Some of the most sought after posts, judging from access logs and search engine queries.

Apple & Macintosh:
Security & Privacy:
Misc technical:
Athens for tourists and visitors:
Life in general:
<< The Privileges of Living in Athens | Main | Θα τους το δώσουν; >>
There are no comments.
You can trackback to:
There are no trackbacks.