Gentoo Archives: gentoo-user

From: Willie Wong <wwong@×××××××××.edu>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] ssh escape command
Date: Thu, 29 Mar 2007 18:44:26
Message-Id: 20070329183841.GA21067@math.princeton.edu
In Reply to: Re: [gentoo-user] ssh escape command by felix@crowfix.com
1 On Thu, Mar 29, 2007 at 09:49:35AM -0700, felix@×××××××.com wrote:
2 > > How do you explain this:
3 > >
4 > > I am in a ssh session. I type "~." to end the session. The first time it
5 > > says command not found, the second time the escape character is recognised
6 > > and executed, I am logged out.
7 > > =========================================
8 > > $ ~.
9 > > -bash: ~.: command not found
10 > > $ Connection to blah.blah.blah. closed.
11 > > =========================================
12 <snip>
13 > This might be what you were seeing, if you had just used "~~." to
14 > terminate a nested session.
15
16 You are on the right track, but not quite:
17
18 >From the man page: the ~ character has to be preceded by a newline to be
19 recognized as special. The reason that ~~. followed by ~. does not terminate
20 your initial connection is because the first layer of ssh still thinks
21 you are typing on the same line. Basically the first layer of ssh sees this
22 sequence "~~.~." and the first two tildes makes it think: ah, this is not
23 an escape sequence, and sends the string "~.~." to the remote shell, the
24 first two of which gets trapped by the second ssh layer to mean disconnect
25 and the second two characters is just received by the shell.
26
27 So, most likely the OP was typing something/anything that gave him a empty
28 prompt without hitting a newline (hitting ^C, ^Z on a running program or
29 just on the shell, typing something and hitting backspace to delete it...)
30
31 Incidentally, you shouldn't need to hit the newline before the disconnect
32 occurs. The minute you actually see the ~ appear on the screen you should
33 know that it is not being interpreted as an escape character.
34
35 W
36 --
37 Willie W. Wong wwong@××××××××××××××.edu
38 408 Fine Hall, Department of Mathematics, Princeton University, Princeton
39 A mathematician's reputation rests on the number of bad proofs he has given.
40 --
41 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] ssh escape command Hans-Werner Hilse <hilse@×××.de>