Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
1  
Why can't you use screen? That allows you to do exactly what you want here. –  Daenyth Jul 28 '10 at 16:08
    
@Daenyth - because some systems don't have it installed, and without root access on those machines, I can't add it :) –  warren Jul 29 '10 at 12:34
    
If the system has a compiler, compile it in your home directory and run it there. If the system doesn't have a compiler, compile it on another system with similar libraries and then copy the file over and run it from your home. I don't think what you ask is possible without using some sort of application -- and screen is the best. Also ask the sysadmin to have it installed, I don't know any competent ones who don't use it. –  Daenyth Jul 29 '10 at 22:48
    
@Daenyth - I know lots of sysadmins who use screen, but disallow regular users from touching it as it has the potential to be a big security hole –  warren Jul 30 '10 at 12:50
    
Also, a variety of systems are routinely scanned for 'non-standard' tools/processes, and are put back to a 'safe' state –  warren Jul 30 '10 at 12:55

2 Answers 2

up vote 2 down vote accepted

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 http://superuser.com/questions/52297/use-gnu-screen-as-login-shell to use screen as a login shell, which removes the need to think to run it.

share|improve this answer
    
thanks, b0fh - looks like this question would require a bunch of the steps mentioned here:superuser.com/questions/28568/screen-a-running-process .. except not so cleanly. Oh well :) –  warren Jul 30 '10 at 14:19

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.