Anyone who has spent any time in a shell and has been cut off while working should know about screen. If not, then I recommend reading up on it (here or here). But I’m not here to tell you about screen as a general tool, I want to show you how to use it for screen sharing. I found a couple of forum posts and other scattered information, so here’s a little centralizing of information.
First a definition, sharing a screen session means both users can at the very least view the same screen (console) at the same time. And depending on the security settings, they can both type as well (which can be very annoying depending on who your sharing the screen session with). I’m going to assume you know the basics so we’ll go on from there.
Let’s assume that I elubow want to share my console with jdoe. After screen is installed, these next 2 steps are critical otherwise the sessions will not be accessible to other users regardless of which commands you issue inside of the screen session:
$ sudo chmod +s /usr/bin/screen # Make screen suid root
$ sudo chmod 755 /var/run/screen # Make the screen dir more open
The easiest way to do this next part is to actually name your screen session. So let’s call our session test.
$ screen -S test
This will create the session and put you in it. Now we need to add the access control. Note: You can automate the multiuser piece by adding it to you .screenrc.
All jdoe has to do now is connect to the same machine and type the following command:
$ screen -x elubow/test # $user/$session_name
There are other security combinations as the above gives jdoe full access. Here are a few common ones:
:aclchg user +rx # Give 'user' read-only access
:aclchg user -x "#,at,aclchg,acladd,acldel,quit" # Don't allow 'user' any of the previous commands
:aclchg user +rwx # Give 'user' read-write access (open permission on the session)