The issue:
You start e.g. a compile or a number-crunching job on your work computer, and go home while leaving it running. When you get home you log on to your work computer via ssh, and want to connect to the terminal in which the job is running i.e. connect to the tty.
Another use for screen is if you are working over an unstable connection -- if you get booted off the screen session continues to run, so whatever was running in it is still sound. A normal pts will die and crash.
A solution using screen:
Be aware that this can cause a potential security risk.
1. install gnu screen
sudo apt-get install screen
2. enable multi-user mode
sudo chmod +s /usr/bin/screen
sudo chmod 755 /var/run/screen
Edit /etc/screenrc and add the following lines anywhere
multiuser onIf you want primitive scrolling (shift + page up/down)
acladd me
termcapinfo xterm|xterms|xs|rxvt ti@:te@Replace me with the local username.
3. On your work computer,
screen -S testing
4. Start whatever job you were thinking of and leave it running
5. From home ssh into your work computer then
screen -x me/testing
Another neat thing is that both terminals look the same no matter whether you are at your work computer or at your home computer. Ergo, it may be a useful way of helping people remotely with their computers too.
6. To disconnect gracefully
Hold CTRL+a+d
Do not type exit or anything like that, as it will close the screen instance completely.
For a gnu screen cheat sheet, look here:
http://www.totiso.com/2009/05/03/gnu-screen-cheat-sheet
No comments:
Post a Comment