Our enterprise firewall is configured to disconnect ssh connections after 30 minutes of of inactivity. Sometimes, I need to perform an operation on a server that requires a sustained connection exceeding this period, but which my shell appears inactive (at least to the firewall).
It seems that opening a second ssh connection with continuous activity (say, running top) isn't enough to sustain the shell. I'd prefer not to set the process to the background and then foreground something more interactive, because any alerts or warnings might escape my attention. I could periodically, repeatedly hit the return key in the shell window every x-minutes, but that's undesirable.
Some programs, like sweep (from Sophos) have a cursor that rotates in the shell, sustaining the connection (that is, it cycles through \ | / – and so on). That works nicely.
Is there some trick, perhaps associated with bash, that could serve this purpose?
In your .ssh/config on your client, try adding something like this.
man ssh_config
From putty, you would want to adjust the
Connection\Seconds between keepalives
to a non-zero value.If running within a
screen
session - you could add "system load" counters to the bottom of the screen (or system date/time - adding something likecaption always "%d.%m.%y %0c%{=b kW}"
to your .screenrc could do that), which will non-regularly generate some minor output (redrawing load numbers or date/time).This is how it looks - lower left corner, system load
An even less straight :) solution (with keepalives being the straightest) would be to have some shell script running in background and generating some output to stderr every 30-60 seconds... E.g.
while true; do echo "ding" > /dev/stderr; sleep 30; done &
.