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 02-06-2013, 05:17 AM   #1
ravirao1981
LQ Newbie
 
Registered: Mar 2012
Posts: 8

Rep: Reputation: Disabled
SSH fails after idle for some time


Hi,
Here is a suitation.

I restart my Suse linux box.
Then, I ssh to this box from another machine.
After a while say after few hours, If the try another ssh session, I get "Server unexpectedly closed network connection" error.
Somehow I figured out that sshd was not starting due to daemonPRNG not seeded.
I recreated /dev/unumber and "daemonPRNG not seeded" issue disappeared. But still I am not able to restart sshd.

If I keep the session busy, say run a top command, then sshd is up, and I am able to log it untill the top is running.


Basically, I beleive the ssh timeout is shutting down sshd and after this I am not able to restart sshd.


Any help??

Thanks,
Ravi
 
Old 02-06-2013, 05:48 AM   #2
jv2112
Member
 
Registered: Jan 2009
Location: New England
Distribution: Arch Linux
Posts: 719

Rep: Reputation: 103Reputation: 103
Lightbulb

Edit the servers /etc/ssh/sshd_config file and updare the two entries highlighted below

Code:

ClientAliveInterval 300 # Every X seconds sends packets through trunnel

ClientAliveCountMax 2  # # of Attempts before it quits, if no response.  

Hope this helps.
 
Old 02-06-2013, 05:52 AM   #3
ravirao1981
LQ Newbie
 
Registered: Mar 2012
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thansk JV2112,
I will try that, but for now, I am not able to restart sshd itself
Is there any way to restart sshd other than restarting the system altogether?

Service sshd restart says "done" but service sssh status shows "unused" any idea what this mean?

Thanks,
Ravi
 
Old 02-07-2013, 05:42 AM   #4
jv2112
Member
 
Registered: Jan 2009
Location: New England
Distribution: Arch Linux
Posts: 719

Rep: Reputation: 103Reputation: 103
Lightbulb

Varies slightly by dsitro:

Code:
Systemd System

systemctl restart sshd.service ( as root )

Init Scripts ( Varies slightly by distro ) 

/etc/rc.d/init.d/sshd restart ( as root )
Hope this helps.
 
Old 02-07-2013, 11:56 AM   #5
Turbocapitalist
Member
 
Registered: Apr 2005
Distribution: Ubuntu, Devuan, OpenBSD
Posts: 985
Blog Entries: 3

Rep: Reputation: 397Reputation: 397Reputation: 397Reputation: 397
If you can't edit sshd_config or restart sshd, you could instead go the other direction and edit ~/.ssh/config to include these:

Code:
ServerAliveInterval 30 # Every X seconds sends packets through tunnel

ServerAliveCountMax 3  # no. of Attempts before it quits, if no response.
 
Old 02-07-2013, 05:21 PM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531
...and if you instead combine 'screen' with 'autossh' you have two worries less wrt having to reconnect manually and the results of killed sessions.
 
  


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 concurrent session limit and idle session time out lasygsd Linux - Newbie 3 10-30-2014 08:56 AM
how to understand user time, sys time, wait time, idle time of CPU guixingyi Linux - Server 1 08-24-2010 11:10 AM
x-windows fails over ssh after a certain amount of time zugvogel Linux - Desktop 5 01-11-2010 10:16 PM
How to logoff the remote ssh session of a user after a certain idle time. ashishshukla Linux - Server 3 10-07-2008 09:57 AM
disable ssh-timout after some idle time papa_anarchia Linux - General 1 11-25-2005 03:38 PM


All times are GMT -5. The time now is 02:35 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration