How to disconnect SSH idle sessions

This example set the maximum time to 15 minutes idle, so open sshd_config file with your favorite text editor as root. In our case vi:

vi /etc/ssh/sshd_config

And be sure this options are set:

ClientAliveInterval 900
ClientAliveCountMax 0

This way after 900 seconds, the ssh session will be terminated, with no keep alive package even being sent. You may adjust the idle time with ClientAliveInterval, set it in seconds to the time you think is enough for your users.

Also be sure the parameter is enabled:

TCPKeepAlive yes

  • 81 Users Found This Useful
Was this answer helpful?

Related Articles

Change of the reverse DNS record for VPS hosting and dedicated server

To change the reverse DNS record for IP address, you’ll need to contact the support department in...

Checking of open connections

If you want to see the open connections to port 25 on your virtual private server or dedicated...

Do I have full root access to my VPS

Yes you do. With virtual hosting (VPS) you get root password for access, trough which you have...

Do I have my own IP address with my virtual server

Yes you do. We provide your own IP address to each virtual private server. If you need more than...

How to create .tar.gz archive

Creating .tar.gz archive can be done with one command. Use the following: tar -pczf...