Hi,
ssh (in recent versions) supports an 'in band' (encrypted) server
alive messages:
ServerAliveCountMax
Sets the number of server alive messages (see below)
which may be sent without ssh(1) receiving any messages
back from the server. If this threshold is reached
while server alive messages are being sent, ssh will
disconnect from the server, terminating the session. It
is important to note that the use of server alive
messages is very different from TCPKeepAlive (below).
The server alive messages are sent through the
encrypted channel and therefore will not be spoofable.
The TCP keepalive option enabled by TCPKeepAlive is
spoofable. The server alive mechanism is valuable when
the client or server depend on knowing when a con-
nection has become inactive.
The default value is 3. If, for example,
ServerAliveInterval (see below) is set to 15 and
ServerAliveCountMax is left at the default, if the
server becomes unresponsive, ssh will disconnect after
approximately 45 seconds. This option applies to
protocol version 2 only.
ServerAliveInterval
Sets a timeout interval in seconds after which if no
data has been received from the server, ssh(1) will
send a message through the encrypted channel to request
a response from the server. The default is 0,
indicating that these messages will not be sent to the
server. This option applies to protocol version 2 only.
So adding something along the lines of -oServerAliveInterval=15 to
your command line when invoking ssh should work. It does work for me ;)
--
Delio
On 15/10/2009, at 10:53 AM, Derek Smithies wrote:
Hi,
I think the scenario you are describing is:
logged into box A.
ssh to box B
do various things.....
halt (on box B)
===
This just sits there - the ssh does not break and return control
to you on box A.
This is identical behaviour to if you had unplugged the ethernet
cable from box B.
the ssh client on box A is waiting for packets from B - and will
wait for "ages". you "can" modify your tcp sockets on box A to have
keep alives etc. This is a bit excessive.
I suggest that you do
ssh to box B
do whateever
sudo su - (become root, which I suspect you have done
to issue the halt command)
halt & exit
and control will immediately return you to box A.
Derek.
On Thu, 15 Oct 2009, Ross Drummond wrote:
If I give the halt command on a remote box while connected through
a ssh
client the ssh client hangs.
How do I prevent this?
Cheers Ross Drummond
--
Derek Smithies Ph.D.
IndraNet Technologies Ltd.
ph +64 3 365 6485
Web: http://www.indranet-technologies.com/
"The only thing IE should be used for is to download Fire Fox"
"My favorite language is call STAR. It's extremely concise. It has
exactly one verb '*', which does exactly what I want at the moment."
--Larry Wall