LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 11-01-2011, 12:42 PM   #1
veeruk101
Member
 
Registered: Mar 2005
Distribution: Ubuntu 12.04 LTS
Posts: 249

Rep: Reputation: 16
Possible to keep ssh session alive even when client computer is off?


I have a Linux laptop that I use to connect to a Linux server with SSH. The connection started to freeze after some inactivity, so after digging around I added the following in /etc/ssh/ssh_config (not sshd_config) on the Linux laptop:

Code:
ServerAliveInterval 60
ServerAliveCountMax 10
Now it no longer freezes, but I get the following (I think only when the laptop has been off, because the configuration above can no longer keep communicating with the server to keep the connection alive).

Code:
Timeout, server not responding.
Connection closed by xxx.xxx.xxx.xxx
Would this problem be solved if I set it to the following, because that should allow for 720 failures at 120 seconds, which equals 1440 minutes, which is a full day. Which is fine for me (if my computer is off for a full day, I'll log in again).

Code:
ServerAliveInterval 120
ServerAliveCountMax 720
Or would the server cut the connection because it's not receiving the keepalive messages from the client, because the client is off...

Alternatively, could I set the following on /etc/ssh/sshd_config on the server? Would that work?

Code:
KeepAlive yes
ClientAliveInterval 120
ClientAliveCountMax 720
I'd rather change the settings on the clients rather than the server, because I'd prefer not to have the server be sending out these messages to all the connected clients every 2 minutes to keep the connections alive. Is there some way to configure an SSH server to simply set a timeout in minutes? That would be perfect, because I'd just set the timeout on the server to be a full day, then in the clients are connected to the SSH server and are turned off, when they're turned back on within the same day they'd still be connected right? That would be exactly the outcome I'd like.
 
Old 11-01-2011, 03:07 PM   #2
samborambo
LQ Newbie
 
Registered: Dec 2004
Location: New Zealand
Distribution: Ubuntu LTS
Posts: 10

Rep: Reputation: 0
Have you used the utility "screen"? It creates persistent shell sessions that can be disconnected by CTRL+A,D and reconnected by running "screen -r". If the parent ssh session is dropped, screen automatically disconnects the session and keeps it running in the background. Of course it also allows you to reconnect a shell session started from a different ssh client.

Sam.
 
  


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
How to restore ssh (pts) session after client's disconnetion? anthon Linux - Newbie 3 08-27-2011 04:10 AM
[SOLVED] X-server crashed. Is my session still alive? smartnose Linux - Newbie 4 06-28-2011 07:25 AM
Need help keeping program alive while killing remote session. jbo5112 Linux - Software 4 05-16-2009 06:49 AM
How can server find whether the connection established with client is alive yugandhar Linux - General 1 08-17-2007 10:03 AM
Opening remote files (during ssh session) with applications on local computer? The_Fed Linux - Newbie 3 05-10-2004 04:20 PM


All times are GMT -5. The time now is 12:40 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