Tuesday, April 06, 2010

Share GNU screen sessions with a different user

Here's something cool you can do with screen. Share a screen session with multiple terminals. "screen -x". Of course, this only works if you're using the same user.


Let's say you want to do some cooperative debugging with another username. Simple:

1. Set screen setuid flag:
chmod +s screen

2. Start a new screen sessions:
screen -S mihai

3. Set multiuser
Ctrl-A
:multiuser on

4. Add the user to join your session to the ACL list:
Ctrl-A
:acladd jimbo

5. Now connect as jimbo and join cmihai's session (called mihai):
screen -x cmihai/mihai


Now you can share you screen session with that user :-).

3 comments:

Fred Chagnon said...

Oops. I think you mean screen -x in that last command.

This is truly an invaluable function of screen that I've come to use over the years.

cmihai said...

Oops indeed. I was thinking screen but my fingers got there first and typed ssh :-).

Yup. Awesome stuff. You can even add restricted permissions (r,w,x) with aclchg. Multiuser mode rocks!

I've been using http://www.sun.com/service/sharedshell/ on public machines for a while now (similar concept, but kind of buggy), but if screen is available, it's much nicer.

Fred Chagnon said...

I like shared shell too, but with screen, the other participant(s) aren't required to have sunsolve accounts.

So I try to reserve shared shell for vendor support while using screen internally amongst my peers.