Code: Select all
screen -d -R remotemachine
# you are still on your local machine at this time
ssh -Y remotemachine
# you are now on remotemachine and can login, go sudo, anything you want. They -Y parameter means you can even run X programs and they will display on your local machine
type Ctrl-a followed by Ctrl-d
# this will detach the screen on the remote machine but LEAVES IT ALL RUNNING
# you are now back at local machine. To re-attach and pick up where you left off, just re-enter
screen -d -R remotemachine