I have an ssh connection that times out on inactivity. I want to put
something in the connection to generate a bit of "noise" on the
connection every so often. I seem to remember having done this in the past
but don't remember how I did it. Can someone help?
Notes:
1) Don't bother telling me I shouldn't do this. That will be sent to /dev/null.
2) I did "man ssh" and "man ssh_config" searching for the word "keep" -
and found a few hits ("ServerAliveCountMax", "TCPKeepAlive",
"ServerAliveInterval", etc), but none of these seem right. In
particular, these options all seem to default to "on" or "yes", yet
the problem still obtains.
3) I'm pretty sure there is (or was) some option that you set to a
numeric value (e.g., 60), that caused it to send something across
every X seconds (e.g., every 60 seconds).
--
> No, I haven't, that's why I'm asking questions. If you won't help me,
> why don't you just go find your lost manhood elsewhere.
CLC in a nutshell.
|
|
0
|
|
|
|
Reply
|
gazelle
|
5/23/2010 8:52:24 PM |
|
Kenny McCormack wrote:
> I have an ssh connection that times out on inactivity. I want to put
> something in the connection to generate a bit of "noise" on the
> connection every so often. I seem to remember having done this in the
> past
> but don't remember how I did it. Can someone help?
>
> Notes:
> 1) Don't bother telling me I shouldn't do this. That will be sent to
> /dev/null.
Why do you think people have it in for you? (SCNR)
> 2) I did "man ssh" and "man ssh_config" searching for the word
> "keep" -
> and found a few hits ("ServerAliveCountMax", "TCPKeepAlive",
> "ServerAliveInterval", etc), but none of these seem right. In
> particular, these options all seem to default to "on" or "yes", yet
> the problem still obtains.
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.
Doesn't seem to be on by default.
> 3) I'm pretty sure there is (or was) some option that you set to a
> numeric value (e.g., 60), that caused it to send something across
> every X seconds (e.g., every 60 seconds).
I used to set the above option to 30 seconds. The actual value you use
depends on how long it takes to your firewall to shut down an inactive
session.
You may also want to set ClientAliveInterval on the server, if possible.
Please also note that, while using ServerAliveInterval made things much
better for me, I still had (and have) cases of idle SSH sessions dying
despite the keepalive.
|
|
0
|
|
|
|
Reply
|
pk
|
5/23/2010 8:56:47 PM
|
|
On May 24, 6:52=A0am, gaze...@shell.xmission.com (Kenny McCormack)
wrote:
> I have an ssh connection that times out on inactivity. =A0I want to put
> something in the connection to generate a bit of "noise" on the
> connection every so often. =A0I seem to remember having done this in the =
past
> but don't remember how I did it. =A0Can someone help?
>
> Notes:
> 1) Don't bother telling me I shouldn't do this. =A0That will be sent to /=
dev/null.
> 2) I did "man ssh" and "man ssh_config" searching for the word "keep" -
> =A0 =A0 and found a few hits ("ServerAliveCountMax", "TCPKeepAlive",
> =A0 =A0 "ServerAliveInterval", etc), but none of these seem right. =A0In
> =A0 =A0 particular, these options all seem to default to "on" or "yes", y=
et
> =A0 =A0 the problem still obtains.
> 3) I'm pretty sure there is (or was) some option that you set to a
> =A0 =A0 numeric value (e.g., 60), that caused it to send something across
> =A0 =A0 every X seconds (e.g., every 60 seconds).
>
> --
>
> > No, I haven't, that's why I'm asking questions. If you won't help me,
> > why don't you just go find your lost manhood elsewhere.
>
> CLC in a nutshell.
In /etc/ssh/ssh_config, I have added the line
ServerAliveInterval 120
Owen
|
|
0
|
|
|
|
Reply
|
Owen
|
5/24/2010 5:08:36 AM
|
|
In article <18a3380b-6d62-4301-96b2-a7a0e07ac458@y18g2000prn.googlegroups.com>,
Owen <xemoth@gmail.com> wrote:
....
>In /etc/ssh/ssh_config, I have added the line
>
> ServerAliveInterval 120
We have a winner! Thanks.
You have to admit that the docs are unclear - seems like there are lots
of options (to read through) to get at one simple concept.
Anyway, as I said, I knew I had figured this out before, but this time
it wasn't so obvious (to me, anyway).
--
(This discussion group is about C, ...)
Wrong. It is only OCCASIONALLY a discussion group
about C; mostly, like most "discussion" groups, it is
off-topic Rorsharch [sic] revelations of the childhood
traumas of the participants...
|
|
0
|
|
|
|
Reply
|
gazelle
|
5/25/2010 12:18:53 PM
|
|
[dropping: comp.unix.programmer as I see no relevance here (config
only)]
On May 25, 5:18=A0am, gazelle@shell.xmission.com (Kenny McCormack)
wrote:
> In article <18a3380b-6d62-4301-96b2-a7a0e07ac458@y18g2000prn.googlegroups=
..com>,Owen =A0<xemoth@gmail.com> wrote:
> >In /etc/ssh/ssh_config, I have added the line
> > =A0 =A0ServerAliveInterval 120
With (reasonably current) ssh, there are two flavors of keepalive:
TCP keepalive
ssh keepalive
TCP keepalive occurs outside of ssh protocol and (if not otherwise
encrypted) in the clear. Those things which may be dropping idle TCP
connections (e.g. stateful firewall) may also explicitly ignore TCP
keepalive packets. I.e. they may intend to drop TCP connections where
the only traffic is TCP keepalive packets, thus TCP keepalive may not
suffice to keep such connections open.
ssh keepalive occurs within the ssh protocol, and thus is (normally)
encrypted, and, for, e.g. stateful firewalls, is typically
indistinguishable from "normal" encrypted ssh traffic, and thus
typically more likely to keep ssh TCP connections "alive" through such
firewalls/devices that may otherwise drop idle connections.
In either case, keepalive can be a bit of a double-edged sword (and
likewise for other TCP or ssh traffic on that connection). Although
it
will often keep an otherwise idle connection from being dropped, in
some
scenarios (notably intermittent connectivity), it will cause
connections
that would otherwise persist, to be dropped. E.g. if we have an
established TCP connection, then it goes completely idle for a very
long
time, then reachability between the two IPs is lost for quite a long
ime, then that reachability is regained, in such a case, idle TCP
connection would still be connected and generally be able to persist
and continue (notwithstanding timeouts implemented on stateful
firewalls or the like), whereas in similar scenario with keepalive
(either TCP or ssh) enabled, the keepalive functionality would
generally determine that the connection was "dead", and would tear
down
that connection.
Poor man's keepalive - crude hack that often suffices to thwart
timeouts
(in some/many cases, also shell or similar system enforced idle
timeouts
- also handy where TCP keepalive doesn't suffice and ssh (older,
client,
server, or protocol) doesn't support ssh keepalive):
$ while :; do sleep 300; echo -en '\007'; done &
Notes: adjust options and/or argument to echo as appropriate for your
flavor of echo (or use print). Adjust sleep argument as suitable
relative to timeout period.
The preceeding may or may not comply with any applicable policy(/ies),
regulation, etc.
|
|
0
|
|
|
|
Reply
|
Michael
|
5/29/2010 1:47:41 PM
|
|
|
4 Replies
1481 Views
(page loaded in 0.061 seconds)
|