[ale] Q: Out of the Nest: ending bottom SSH session (ASCII Art Alert)

Michael H. Warfield mhw at WittsEnd.com
Thu Dec 11 10:56:49 EST 2008


John,

On Thu, 2008-12-11 at 10:31 -0500, John Mills wrote:
> ALErs -

> I frequently open an SSH console from one Linux host to another, then from 
> the second to a third:

>    +-------+ SSH     (SSH) +-------+ SSH +---+
>    | larry |---->[FW]----->| curly |---->|moe|
>    +-------+               +-------+     +---+

> Between 'larry' and 'curly' is a firewall that forwards incoming SSH only 
> to 'curly' so I can't bypass that node.

> larry: ~$ ssh curly
> curly: ~> ssh moe
> moe: / [and do some work here]
> moe: / < NOW_GET_ME_OUTA_HERE!! />

> My problem is that an 'exit' call from my console (supposedly on 'moe') is 
> intercepted and actually closes the top-level session on 'larry'. My exit 
> (or recovery) procedure thus becomes:

	You quoted 'exit'.  That immediately raises the question of "how did
you exit" since there are several ways.

	Literally typing "exit" or ^D should exit the shell on moe and leave
you on curly which may thing exit itself or continue doing what every
you have defined there.

	If you are using "~." to terminate the ssh connection (a convention
inherited from the old uucp utility cu and, I think, rsh as well) then
~. terminates the ssh client shell on larry while ~~. terminates the ssh
client shell on curly and ~~~. would terminate an ssh client shell (if
you were running one) on moe.  The first escaped ~~ pair sends a ~ and
everything following it on to the next, essentially stripping one
leading ~ off.  So you merely daisy chain out as many as you need for
the number of hops you are away.  1 for local, 2 for the next, etc.
I've done this so far out that I use to use a Dungeons and Dragons die
to keep track of depth.

> 1) open another SSH console to 'curly'
> 2) from that, close the SSH login to 'moe' (with some kind of
>   'ps ...|grep ...| kill -9...')
> 3) close or use the 2nd session on 'curly'
> 
> Q: How, when I'm logged into 'moe' can I "escape" my 'exit' call and close 
> just that bottom-level shell, returning directly to my session on 'curly'? 
> Each is running a BASH shell.

	If you are not using the ~. method to terminate the ssh shell, you'll
have to be more explicit about how you are "exiting" since nothing else
makes sense.  I had to merely assume that's what you meant.

> TIA.
> 
>   - Mills

	Mike
-- 
Michael H. Warfield (AI4NB) | (770) 985-6132 |  mhw at WittsEnd.com
   /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
   NIC whois: MHW9          | An optimist believes we live in the best of all
 PGP Key: 0xDF1DD471        | possible worlds.  A pessimist is sure of it!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: This is a digitally signed message part
Url : http://mail.ale.org/pipermail/ale/attachments/20081211/4f754078/attachment.bin 


More information about the Ale mailing list