The Mad Philosopher » ssh keep-alive tip

The Mad Philosopher » ssh keep-alive tip
ssh keep-alive tip

Whenever I login remotely to my machine in Canada, the ssh session dies after a while if I don’t actively type something. This is not the server timing out, but rather the TCP connection hanging. Figuring out a way to keep sending it keystrokes automatically is beyond my ability, but I found out that I could just have it send me data continually, and that works just as well to keep the terminal session alive. The following Bourne Shell loop works:

> while date ; do sleep 10 ; done

This just prints the date and time to my terminal every 10 seconds. At any time, I can interrupt it with a CTRL-C and continue to use the session. So now you know.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s