LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Take over an ssh session. (https://www.linuxquestions.org/questions/linux-networking-3/take-over-an-ssh-session-643389/)

mikesjays 05-19-2008 08:43 PM

Take over an ssh session.
 
I was wondering if there is a way to take over an ssh session. Here is the setup. I opened an ssh session from my pc at work, I used elinks to start downloading a file, the file is a 3gb file. Now I'm home and I want to move that ssh session to my laptop on my home network.


Is there a way to do this?

MensaWater 05-19-2008 10:35 PM

Not after the fact.

There is a tool called "screen" that you can start any command on. Once started you can attach to the same "screen" session from another terminal - you can even shutdown the terminal on which you started the original session. This is typically what I do if I need to start something while at work and access the same session from home later.

tox2ik 05-19-2008 11:35 PM

sdr
 
go like this:
Code:

alias sdr="screen -DR"
sdr [name]
top

now press: CTRL + A + D
to attach the screen again anywhere (assuming you have the sdr alias there too) type

Code:

sdr [name]

mikesjays 05-20-2008 07:00 AM

I will have to give it a shot today thank you.

MensaWater 05-20-2008 10:36 AM

Some notes on screen:

screen -list - Shows screen session names
screen -S <name> - Starts screen session and gives it <name> as name.
screen -x <pid> - Attaches to existing screen session with PID of <pid>
Ctrl-A - Main command to use within screen. Selected options:
Ctrl-A ? - Gives a list of all options
Ctrl-A 0 - Goes to first window within a screen session.
Ctrl-A 1 - Goes to second window within a screen session.
Ctrl-A <n> - Goes to nth window within a screen session.
Doing exit from within a screen session will fall back to previous window.
Doing exit from all windows in screen session will terminate screen.
Closing window that has a screen session will leave it running and detached.

I haven't tried the alias configuration noted by other poster. Note that the "top" he puts there is a separate command presumably he is listing that to give you an example of something that he has run under screen. Unless you expect to be doing this all the time I'd recommend against setting up the alias as you might not remember its name 6 months from now when you next do it whereas screen is something that should appear quickly on a google search.

milasch 07-17-2008 06:06 PM

That would be great to know before I started my download! lol... I'm googling for a while now how to take over a process itself, if there is such a thing... something like: screen --takeover [pid]... because I also have started a big download and have no idea how it's going. Any ideas?

jomen 07-17-2008 06:37 PM

If you used "wget" for it - just "CTRL-C" (interrupt) it - and you can always restart it with "wget -c your_url".
...this time in a screen session...

Firefox also has the ability to resume interrupted downloads. (Menu: Tools --> Downloads)

MensaWater 07-18-2008 07:33 AM

Quote:

Originally Posted by milasch (Post 3218157)
That would be great to know before I started my download! lol... I'm googling for a while now how to take over a process itself, if there is such a thing... something like: screen --takeover [pid]... because I also have started a big download and have no idea how it's going. Any ideas?

In a word: No.

Since the thread is a couple of months old I'll assume you didn't search for a solution BEFORE you started. :tisk:

At least you'll know for future downloads. :D

milasch 07-18-2008 08:20 AM

Now, guess what? as soon as I click "Submit reply" i figured my download was completed... I guess I'm still not used to download stuff at 1.1mbps... It gets me thinking, once (more than 13 years ago) I installed a big brand software at home using 52 floppy disks, took me over 6 hours, now I download almost a floppy disk/second with a so so connection.


All times are GMT -5. The time now is 02:37 PM.