LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to disconnect inactive ssh sessions ? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-disconnect-inactive-ssh-sessions-702300/)

sultf 02-04-2009 01:20 PM

How to disconnect inactive ssh sessions ?
 
Hi,
I want inactive ssh sessions to get disconnected after 5 minutes. I have configured following in sshd_config

ClientAliveInterval 100
ClientAliveCountMax 3
TCPKeepAlive no


But, the inactive session is not getting disconnected. Would appreciate help.

Thx
fs

arizonagroovejet 02-04-2009 01:41 PM

Did you restart sshd after making changes to the sshd_config?

An alternate way to do what you want if your users use ksh or bash is to use the the TMOUT option. Assign a number to that variable and the shell session is ended after that many seconds of inactivity. Set it in /etc/bashrc or suitable equivalent (/etc/bash.bashrc on SuSE systems and read the comments at the top.) To only set the variable in shell sessions resulting from ssh logins wrap the declaration in a conditional statement based upon where they logged in from using output of 'who' or something.

sultf 02-04-2009 01:44 PM

Thanks. I have restarted sshd. I will try time out option in profile.

sultf 02-04-2009 02:28 PM

Hi,
I have tried TMOUT in profile. This works only if the user is in the shell. It didn't work if user is viewing file thru 'vi'.

fs


All times are GMT -5. The time now is 01:09 AM.