LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 12-28-2011, 03:53 AM   #1
shmoolm
LQ Newbie
 
Registered: Dec 2011
Posts: 4

Rep: Reputation: Disabled
SSH disconnect time


Hello everyone,
How do I change the time for the ssh live connection?
I mean, when I am leaving my ssh connection for 1 min i get disconnected from it and I need to reconnect again.
I changed the ClientAliveInterval 0 in the /etc/ssh/sshd.conf file but its not working.
Any suggestion ??

Thanks.
 
Old 12-28-2011, 04:07 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400
Hi,
Quote:
Originally Posted by shmoolm View Post
Hello everyone,
How do I change the time for the ssh live connection?
I mean, when I am leaving my ssh connection for 1 min i get disconnected from it and I need to reconnect again.
I changed the ClientAliveInterval 0 in the /etc/ssh/sshd.conf file but its not working.
Any suggestion ??

Thanks.
Have a look here: Keep Your Linux SSH Session From Disconnecting

Hope this helps.
 
1 members found this post helpful.
Old 12-28-2011, 05:12 AM   #3
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,415

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
Edit your ssh_config file, usually in /etc/ssh/ directory:

Quote:
# vi /etc/ssh/ssh_config
And put this line in the file:

ServerAliveInterval 60

Save and exit.

Open the ~/.ssh/config file (or create it if not present) and put this line in it:

Host *
ServerAliveInterval 60


Don’t forget the indent at the second line. Save and exit.

Lastly, reload your new SSH config file by doing:

# /etc/init.d/sshd reload
 
1 members found this post helpful.
Old 12-28-2011, 07:41 AM   #4
shmoolm
LQ Newbie
 
Registered: Dec 2011
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Satyaveer Arya View Post
Edit your ssh_config file, usually in /etc/ssh/ directory:



And put this line in the file:

ServerAliveInterval 60

Save and exit.

Open the ~/.ssh/config file (or create it if not present) and put this line in it:

Host *
ServerAliveInterval 60


Donít forget the indent at the second line. Save and exit.

Lastly, reload your new SSH config file by doing:

# /etc/init.d/sshd reload


Hi, its not working for me.... I'm steel disconnecting from the server
I changed those two settings....
 
Old 12-28-2011, 07:44 AM   #5
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,415

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
Which OS you are using?
 
1 members found this post helpful.
Old 12-28-2011, 08:19 AM   #6
shmoolm
LQ Newbie
 
Registered: Dec 2011
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Satyaveer Arya View Post
Which OS you are using?
Centos 6

Last edited by shmoolm; 12-28-2011 at 08:25 AM.
 
Old 12-28-2011, 08:42 AM   #7
Michal Krzyz
Member
 
Registered: Nov 2011
Distribution: OpenBSD, Ubuntu, Debian, Slackware, LFS
Posts: 44

Rep: Reputation: Disabled
Are You sure that You put indention after line with Host *?

Host *
(one space here)ServerAliveInterval 60
 
1 members found this post helpful.
Old 12-28-2011, 08:52 AM   #8
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,415

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
CentOS default is no timeout IIRC in /etc/ssh/sshd_config. The option is "ClientAliveInterval" if it is sshd timing you out. You can check for a "TMOUT" environment variable that could also do it.
 
Old 12-28-2011, 03:05 PM   #9
shmoolm
LQ Newbie
 
Registered: Dec 2011
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Michal Krzyz View Post
Are You sure that You put indention after line with Host *?

Host *
(one space here)ServerAliveInterval 60
Yes its working now.. i had a spelling mistake.
Thank you all.
 
Old 09-22-2016, 05:54 PM   #10
thomfriedel
LQ Newbie
 
Registered: Sep 2016
Posts: 1

Rep: Reputation: Disabled
SSh disconnect by ISP

None of that worked for me, but I was under the assumption my ISP was timing me out. I live in Colombia, so seem to have the problem in most but not all places (convincing me it is an ISP issue and not my server).
 
  


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
ssh connection getting disconnect mosharaf_linux Linux - Server 2 10-18-2011 05:03 AM
disconnect idle ssh sessions pinoyskull Linux - Newbie 19 03-02-2010 03:29 AM
SSH disconnect, connect to process briel Linux - General 2 11-24-2006 04:32 PM
How t disconnect an SSH'd user? DarkElf109 Linux - Networking 2 01-20-2006 09:57 PM
internet disconnect time fstreed Linux - Newbie 0 12-25-2002 10:20 AM

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

All times are GMT -5. The time now is 11:54 AM.

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