I have recently ventured into using screen (a virtual terminal in linux) in a multiuser setting. This is necessary when users need to collaborate on a project or for server which run their console in a “not” daemon sort of way.

Basically, you can setup a virtual terminal and allow other people to access it. You can even be in the same shell as someone else which is extremely useful for helping other configure settings or program. Here’s how!

NOTE: This guide assumes you already know some basic commands pertaining to using screen and understand what this powerful software can do.

So lets make a new screen session and call it “test”. I then want to share out this screen session with two other users, john and bill. First I will create and add the following to my .screenrc file in my home directory.

multiuser on addacl john addacl bill

Then I will start my screen session:

mario@box:$ screen -S test

This will make your screen and throw you in it. Now here’s what john can do to jump into our screen session we just created:

john@box:$ screen -x mario/test

This will put john into our shell. Note that he now pretty much has full control of this shell under your user account! Keep this in mind and make sure you trust the people you are letting into your sessions.

To join in with john simply type:

screen -x test

Note that using the ‘-x’ allows multiple people to be connected to the screen. To totally take over and attach the screen for yourself, use ‘-dr’ which will detach the shell with whomever has it attached, and re-attach it for you.

UPDATE: After working with a few different systems, it seems as though there are some errors that appear on certain systems pertaining to suid bits and such with screen..The following should fix this.

# chmod u+s /usr/bin/screen # chmod 755 /var/run/screen

Mario Loria is a builder of diverse infrastructure with modern workloads on both bare-metal and cloud platforms. He's traversed roles in system administration, network engineering, and DevOps. You can learn more about him here.