LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 01-16-2013, 01:51 PM   #1
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Rep: Reputation: 49
Inactivity timeout for SSH sessions


I did some googling, and everything seems to say to
add the following two things into /etc/ssh/sshd_config

ClientAliveInterval 600
ClientAliveCountMax 3

But when I look at an existing server we have that disconnects a putty session if left idle, those two settings are commented out in the file. Maybe I'm searching for the wrong thing, or there's another way to do it?
 
Old 01-16-2013, 01:55 PM   #2
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
/etc/ssh/sshrc can also contain these directives. did you check there and the other files under /etc/ssh/?
 
Old 01-16-2013, 02:02 PM   #3
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
an existing server we have that disconnects a putty session...
putty on Windows?
A.7.10 My PuTTY sessions unexpectedly close after they are idle for a while. points to
4.13.1 Using keepalives to prevent disconnection
 
Old 01-16-2013, 02:37 PM   #4
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
they both appear to be commented out in every file that has them in /etc/ssh
 
Old 01-16-2013, 05:21 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Check the header of /etc/ssh/sshd_config
Code:
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options change a
# default value.
Samba does something similar ie lines beginning with '#' are doc comments, lines beginning with ';' are like ssh; default values commented out.

HTH
 
Old 01-17-2013, 02:34 AM   #6
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
OK, on the server i'm looking at that disconnects, and the new one that doesn't appear to (or maybe it's just set to some much great value perhaps), the two settings mentioned above both have # in front of them and both have the same number. So I'm thinking there has to be another spot to set this, maybe?
 
Old 01-17-2013, 05:54 AM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Here's the full manpage http://www.openbsd.org/cgi-bin/man.c...penBSD+Current which describes the options in detail.
It may even come down to tweaking the client settings as mentioned there.
 
Old 01-17-2013, 06:11 AM   #8
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
I guess I'm not understanding how if it's commented out on a server that does timeout a session after a period just like it is on this server, how it is this setting even. unless i'm just totally missing something here.
 
Old 01-17-2013, 07:05 PM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
If(?) I understand your qn (& it is a bit confusing I agree), here is the situation.

At install time, sshd_config is pre-created for you, with the most-likely-to-be-required options already specified in the file.
The default values are used/set, BUT the line in the cfg file marks them as commented out (nonetheless, they ARE active).
This enables you to easily see which options are in the default setting and what those values are.
It also saves you having to guess/research a reasonable value for it.
If a setting is NOT commented out, it has likely been amended by a human being.

In Samba they use '#' & ';' to distinguish between doc comments ( # ) and default settings values ( ; ).

HTH
 
Old 01-18-2013, 07:58 AM   #10
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
Yeah, I gotcha now. Kinda odd in my mind that is uses default settings, but it leaves them commented out, you'd think it just have them in there uncommented set to the default value, then still have the note in the comments. Or at least that's how i'd do it haha.

I'm going to open up a session to that server and just let it sit for a few hours, see if it disconnects me or not. Maybe I really didn't have to do anything in the first place, other than not work so much on the server haha.

Thanks for the help Chris, you are always extremely helpful, and can break it down into something I can understand.
 
  


Reply



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
Inactivity timeout (--ping-restart) in OpenVpn ajayan Linux - Newbie 3 04-27-2010 06:36 AM
[SOLVED] How to Change Inactivity Timeout The Old Crab Linux - General 2 03-26-2010 12:00 PM
Account Inactivity Timeout JonBL Fedora 2 10-21-2006 07:32 PM
Inactivity Timeout thisObject Linux - Software 3 07-27-2006 01:48 AM
sshd timeout for inactivity. acid2000 Linux - Software 5 03-18-2003 09:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:27 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
Open Source Consulting | Domain Registration