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

  • 66 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...

Buy VPS with Payeer

VPS is a virtual private server. It’s basically a virtual server that gives you master...

Buy web hosting with Alipay

Web Hosting With Alipay Web hosting is a type of service whereby a person or a company is...

How to secure /tmp, /var/tmp and /dev/shm with OpenVZ

First open fstab using nano, or your chosen editor: nano -w /etc/fstab   Next append the...

Software installed by default in a VPS hosting server

All VPS hosting servers are coming with following software pre-installed in each VPS server:1....