2

Outside of using something like screen, is it possible to 'assume' an active user session under Linux/UNIX?

For example, I ssh to my server from home. Then I ssh to it form work. I want to kill the home-spawned session, and "take-over" all of the processes that it had running.

warren@home> ssh warren@myserver
warren@myserver> top

...

warren@work> ssh warren@myserver
warren@myserver> <grab-other-session-of-mine>

After the <grab-other-session-of-mine> command/tool, the warren@home ssh session should be closed.

Is this possible?

warren
  • 10,322

2 Answers2

3

As far as I know this is not possible. What's wrong with screen or equivalents ?

The processes from your session are bound to their current tty and parent process, changing these would lead to a number of nasty problems, so it would require an abstraction layer that provides your worker processes with a persistent tty and parent. This is what screen and friends does; not using these would require putting the feature in the sshd itself.

See Use GNU screen as login "shell" to use screen as a login shell, which removes the need to think to run it.

b0fh
  • 2,335
1

First: Yes. You can do this if and only if you have recorded the TCP session (Not sure how much of this is necessary, but you need to have access to the packet capture), have the right tools and expertise, have full control of packets being generated on a machine between the client and server, and have access to the server private key. You could conceivably take over the TCP connection, impersonate the originating client, and begin transmitting and receiving data on the existing connection.

But that would be silly and far harder than it is worth, so practically speaking, no, you can't do it without using a tool like screen.