LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-04-2009, 02:20 PM   #1
sultf
LQ Newbie
 
Registered: Jan 2009
Posts: 6

Rep: Reputation: 0
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
 
Old 02-04-2009, 02:41 PM   #2
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,078

Rep: Reputation: 195Reputation: 195
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.
 
Old 02-04-2009, 02:44 PM   #3
sultf
LQ Newbie
 
Registered: Jan 2009
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks. I have restarted sshd. I will try time out option in profile.
 
Old 02-04-2009, 03:28 PM   #4
sultf
LQ Newbie
 
Registered: Jan 2009
Posts: 6

Original Poster
Rep: Reputation: 0
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
disconnect idle ssh sessions pinoyskull Linux - Newbie 19 03-02-2010 04:29 AM
defunct/inactive telnet sessions tpmadigan Linux - Enterprise 2 02-04-2008 09:56 AM
SSH disconnect, connect to process briel Linux - General 2 11-24-2006 05:32 PM
SSH on LAN - server disconnect geek745 Linux - Networking 13 02-28-2006 05:28 PM
Keep running a command when disconnect from SSH stuartornum Linux - General 3 02-17-2006 11:19 PM


All times are GMT -5. The time now is 02:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration