dimecres, 4 de febrer de 2015

Anti idle shh linux

Two ways to solve idle problem for ssh connections:

On the server, login as root and edit /etc/ssh/sshd_config and add the line:

ClientAliveInterval 60

According to man sshd_config, this line,
Sets a timeout interval in seconds after which if no data has been received from the client, sshd(8) will send a message through the encrypted channel to request a response from the client. The default is 0, indicating that these messages will not be sent to the client. This option applies to protocol version 2 only.

Don’t forget to restart sshd on the server after you save the file.


The other way, and easier and safer way is for your desktop machine to send those keep alive messages. As root on your desktop (or client) machine, edit /etc/ssh/ssh_config and add the line:

ServerAliveInterval 60

That will send send a message to the server every 60 seconds, keeping the connection open. I prefer this way because I login to several machines every day, and I don’t have root access to all of them.