[nycbug-talk] X and screen. was: BSD on a desktop

michael lists
Sun Aug 1 07:13:10 EDT 2004


on 20040731 2:04 PM pete wright had written...

> 
> hey marc,
>     here is a dumb question...can you run say Xterm in a screen session, 
> detach the session (along with xterm) then re-attach the session 
> somewhere else and have the xterm come back.  i've tried it out, but 
> have a feeling that it's not possible or i'm missing a swtich somewhere.
> 
> -p
> 

Pete,
I'm also a big fan of screen.  The 2 main situations I use it are

1.) ssh into a remote server- start a screen session - do stuff, maybe 
kick off a long compile, dettach.  I can then go to work- ssh into that 
server and reattach.  The process has been running and I can pick up 
where I left off.

2.) I was uncomfortable with running x on a workstation then walking 
away.  Anyone could kill the session and drop down to a prompt... with 
my credentials.  So, I actually use it everytime I run startx.  May 
would say a common solution would be to use a display manager like XDM, 
KDM, GDM but.. Common solutions are not always the right ones or the 
most secure ones.  I may be wrong, but, as far as I know:

-- Display mgrs require you to run X.. there are many times I just don't 
want to
-- Display mgrs require you to launch X as root.
-- Display mgrs control your machine.. it is very difficult to close X 
and drop to a prompt... say, if you were going to do a large compile and 
wanted to free up some overhead

I wanted to secure my workstation, but, I didn't want to loose access to 
my console altogether.

Option "DontVTSwitch" "true"
Option "DontZap" "true"

... would have required a reboot in case something went wrong with X. 
Disabling "magic sysreq key" and ctrl+alt+del could also lock me out of 
my own box... except for the Power button and the wall plug.

My answer was to use a very familiar utility called 'screen'.

1) I logon as a user (not root)
2) type 'screen', and I'm given a new prompt
3) at the new prompt I type 'startx'. Which ever WM/DE is set in the 
.xinitrc loads (KDE, GNOME, fluxbox...etc).
4) <CTRL><ALT><F1> takes me back to the 'screen' prompt.
5) "<CTRL><A> d" to detach ('man screen' for more) and I'm back at the 
original prompt.
6) from here I can 'logout'... the logon prompt appears.
7) <CTRL><ALT><F7> takes me back to the WM/DE

I only have to do this once for each re-boot, which is not often.

Now I can use any X screensaver/lock I choose. I can walk away from my 
desk knowing X is locked and the box is secured. Without my password, 
noone can use my credentials. If they need the box, they can log in 
themselves. I can also recover from any X mishaps more gracefully than a 
re-boot.

Michael




More information about the talk mailing list