16 January 2014

Config ssh client to keep alive with server not to expire session to soon

As a system admin, I always using ssh to connect to my servers almost at everyday. I really that by default an ssh session will soony expired if you dont touch the keyboard for a while (for example if you just go to the rest room for minutes).

How to prevent this happen ?

The answer is very simple, I will show you how to keep long alive session with sshd server.

Just open the ssh (client) config file at : #vim /etc/ssh/ssh_config

and insert a line : ServerAliveInterval 30

This will intervaly 30s send an keep alive package to the server.

From now on your ssh connection will live until you disconnect or log out the session, dont worry about time out anymore.