#!/bin/bash # # This program is used to keep a remote session alive by echoing nulls to a # terminal after a minute of idle time. Use if if you see # [root@unix root]# Read from remote host unix: Connection reset by peer # Connection to unix closed. # after a short idle time. This often happens when ssh is port forwarded # through a firewall device. # # You will probably want to run this program in the background. Don't forget # to kill it before logging out! # # If you are on debian, you should use ssh's ProtocolKeepAlive setting. This # parameter is debian specific, the rest of us are still waiting for openssh # to pick it up. # # If you have root access on either box, you can also do # echo 60 >/proc/sys/net/ipv4/tcp_keepalive_time # and the tcp keepalives will keep the connection open. # TTY=$(tty) while true do find $TTY -mmin +1 | grep -q $TTY && echo -ne "\0" sleep 1 done