3

Say I start a process from the local shell - keyboard, mouse, monitor connected directly to actual physical computer...

I then go to a second computer and SSH into the first computer.

Can I switch to the local shell that's running the process on the first computer?

Specifically I'm using putty to connect to Ubuntu Server 16.04. I want to see the local shell and interact with it. On Windows when I Remote Desktop and log in as the user it picks up that connection/session... I'm just not sure how to do it on linux so that I can monitor/continue/break/interact-with a running process remotely.

  • 5
    You may want to check out what screen can do for you. Open terminal, start screen. Do stuff. Disconnect from screen. Log out. Log in from elsewhere, reconnect to your screen process, and everything is still there and running and doing whatever it was doing when you left it. – ivanivan Feb 23 '17 at 4:02
  • VNC server/client will match what rdp does in windows. For all other remoting posibilities that windows do not have, your question needs to be more specific. and no ssh can not just take over keyboard and monitor of other computer. – MetNP Feb 23 '17 at 6:17
  • I've used RealVNC/TightVNC on windows and hadn't considered looking into the same/similar for Linux... but that's basically what I'm looking for. I'll also look into Screen as that also looks like a solid option for what I'm after. – WernerCD Feb 23 '17 at 16:36
  • vnc works well in linux if you need gui, but screen and tmux are much better and faster and more powerfull solutions that will work anywhere and inside ssh (if you just forget mouse and graphics). – MetNP Feb 23 '17 at 17:33
  • 1
    Use a terminal multiplexer as login shell => screen. – ingopingo Feb 23 '17 at 18:20
0

You can background the ssh session using ~^Z (saying Enter ~ Ctrl+Z) escape sequence (after the newline).

This will simply background your ssh job and you can restore the session by writing %1 (brings job back to foreground -- use different number if you suspended more jobs already). Example:

[local]$ ssh remote
jakuje@remote:~$ ~^Z [suspend ssh]

[1]+  Stopped                 ssh remote
[local]$ %1
ssh remote

remote:~$

For more about escape sequences that can be useful during the ssh session, have a look into manual page for ssh.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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