Linux SSH session getting stuck


New Member
Mar 4, 2020
Reaction score

Am currently having a ubuntu 16 server. The server should be monitored and if it is idle for 10 min then it should stop. For stop I have done some scripting.
The problem that I'm facing is that,
I am calculating idle timeout by w command. In order to kill the ssh session which is idle, I added ClientAliveInterval 600, ClientAliveCountMax 0 in sshd_config file and restarted the service. So when I open 2 ssh session and leave one idle and I will start monitoring the session idle time by giving W command in another session. When clicking w command 2 session will be displayed. After 10 min only one session will be displayed, which is perfect. But when I click the session at 5th min the terminal is stuck and cannot execute any commands. But the session is still getting monitored in the w command and in the log to there is no information saying the session is killed. But after the 10 min only the session is killed. The problem is getting stuck.
I did change the ClientAliveInterval 5m, ClientAliveCountMax 2 and many values has been changed. And changed tcpkeepalive from yes to no. Nothing happened.

Please guide me with this Or is there any other way for monitoring the session and kill it.


Staff online

Members online

Latest posts