Using Multiuser Sessions in GNU Screen

GNU Screen is a fantastic utility; however, if you want to use multiuser sessions – that is to share your screen session with another user – you’ll have to set it up.

First, you have to make sure that multiuser capabilities are in the screen binary. We’ll assume for purposes of this article that screen has already been compiled with multiuser capabilities – it appears that most prepackaged versions of GNU screen should have these capabilities already built in.

Make sure that the screen binary is properly configured to use the multiuser capabilities with these steps:

  • Make screen suid: chmod u+s $(which screen). This can be dangerous: you have to trust screen not to have anything in it (such as bugs) that will permit a user to take over as root.
  • Make sure that the directory /var/run/screen exists and has permissions of 755.

Now that screen is set up, run the initial screen session and prep it for multiuser access:

  • As a regular user, run GNU screen.
  • Start multiuser mode with the multiuser on screen command.
  • Allow a user to access the session by using the screen command acladd user with the appropriate user name or names.

Finally, the user who wants to access your screen session needs to run screen on the same system thusly:

screen -x shareduser/

This assumes that you ran the initial screen session as shareduser – and don’t leave off the final slash as that is necessary to make this work.

If you want to give this session a name (to separate it from your normal screen session perhaps), then use this command to start the session:

screen -S shared

Then let the other user use this command to connect:

screen -x shareduser/shared

That is, the user running the screen session is shareduser and the session name is shared.

There are more screen commands that are useful in multiuser mode; they are described the manual in section 8.4. There is also another web page that provides some tips on using screen, mostly focusing on multiuser mode – including how to create read-only users.

Using GNU Screen with SSH (and other tutorials)

There are also a number of tutorials on how to keep environment variables set in screen sessions. Why does this matter? Because SSH relies on it – for SSH agent operation, as well as X forwarding. Thus, each of the articles solve a slightly different problem, but it all comes out to the same thing: getting the environment variables right.

Many of the tutorials start with this problem: one starts ssh-agent, then screen: now how do the sessions maintain the proper environment variables? This article by Charles Fry shows a way to craft a screen initialization script with the proper variables. This article suggests using a screen “wrapper”: run screen first, then ssh-agent, the screen again. The inner screen session then becomes the main session, and the outter session mainly holds the results of the ssh-agent run.

Some tutorials handle a different problem: one starts ssh-agent, then connects to another machine with ssh – then runs screen after that. That screen session will become “disconnected” from the ssh-agent forwarding scheme once you exit and connect to it from another machine. The environment variables are no longer valid. The basic solution is to overwrite the session environment variables with the current (and correct) version. Samat Jain has an article on this, and Sam Rowe also has an interesting article at about the same thing.

On a different note, there is an excellent tutorial and overview of GNU screen at While it is from July of 2007, it remains up to date – I just don’t know why I haven’t seen it until now. If you haven’t started using screen, this is a good place to begin.

Of course, there is my book GNU Screen: A Comprehensive Introduction.

Presentations using PDFs

Since I will be presenting soon (a talk on GNU Screen at the Chicago Linux User’s Group) I am once again considering how to present a slide show. I created the slide presentation in NeoOffice, and saved it to several presentation formats.

However, I was introduced to one presentation format which I was not aware of before: PDF. I had never thought of using a PDF for a presentation. That is, create a PDF from your slide show, and use a viewer such as Evince to present it. I think even the current Adobe Acrobat will support this, as do several others – I think Skim (for MacOS X) also supports a full-screen mode for presentations, as does KPDF for KDE.

In the past, I’ve used full-screen as a way to read the selected PDF; however, it looks like the full-screen mode was designed for presentations entirely – and this is true of all of these PDF readers.

Give it a try today!