LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-09-2019, 07:48 PM   #1
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Reconnecting to a disconnected ssh session?


I run Xubuntu in a VirtualBox VM on my Windows PC. Last night I saved the VM before shutting down the PC.

This morning, after restarting the VM, I find three ssh sessions from yesterday. For example this one:
Code:
$ ps -ftpts/2
UID        PID  PPID  C STIME TTY          TIME CMD
bbausch   5003  5002  0 10月06 pts/2  00:00:01 -bash
bbausch  27965  5003  0 10月09 pts/2  00:00:06 vi what-i-learned
bash's parent, sshd, is sitting there waiting for the ssh client to talk to it, but the client doesn't exist anymore. This particular session has been up for almost a week, it seems:
Code:
$ who
bbausch  pts/2        2019-10-04 10:42 (10.0.2.2)
...
I have no real problem killing that Bash process, but I wonder if there is a way to reconnect to such an orphaned session in order to recover whatever can be recovered.

Yes I know about tools like screen and tmux. Unfortunately they only help if you use them before the connection is severed.

Last edited by berndbausch; 10-09-2019 at 07:49 PM. Reason: added who output
 
Old 10-09-2019, 08:29 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

there used be a program called retty that could do this. Seems not to be in current distros though. See for example https://packages.debian.org/jessie/retty

I stopped using retty after I discovered screen, which I stopped using after I discovered tmux :-)
Now I'm in the habit of using tmux on basically *all* remote sessions.

Evo2.
 
1 members found this post helpful.
Old 10-09-2019, 09:05 PM   #3
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Original Poster
Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by evo2 View Post

I stopped using retty after I discovered screen, which I stopped using after I discovered tmux :-)
Now I'm in the habit of using tmux on basically *all* remote sessions.

Evo2.
I like your evolution. Fits the user name. Thanks.

EDIT: retty is not in the Ubuntu repos. Some more work required to try it out.

Last edited by berndbausch; 10-09-2019 at 09:06 PM.
 
Old 10-09-2019, 10:16 PM   #4
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,
Quote:
Originally Posted by berndbausch View Post
EDIT: retty is not in the Ubuntu repos. Some more work required to try it out.
Yes, that's because Debian dropped it because it was not maintained.
See https://tracker.debian.org/pkg/retty
I'd be a little careful about using it: who knows what bugs it has.

Evo2.
 
Old 10-09-2019, 11:04 PM   #5
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Original Poster
Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by evo2 View Post
I'd be a little careful about using it: who knows what bugs it has.
For one thing, its build includes assembler files. I don't understand why that is necessary. What's more, they seem to work on 32 bit kernels or CPUs only.
 
  


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
Unable to launch "cinnamon-session-cinnamon" X session "cinnamon-session-cinnamon" -found; Falling back to default "session." xxxindigo Linux Mint 22 09-01-2019 09:21 AM
Session key renegotiation if session lasts longer than configured (e.g. an hour) then session keys needs to be renegotiated. dakshinya Linux - Newbie 1 02-04-2016 04:15 PM
how to set ssh/putty session running in disconnected mode aamerjavaid Linux - Newbie 7 07-08-2011 08:53 AM
getting back disconnected remote session beowulfnode Linux - Newbie 1 06-30-2007 04:41 AM
Why is my WUSB54G not reconnecting when disconnected? (FC5 2.6.17 custom kernel) zykes Linux - Hardware 0 06-29-2006 02:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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