How to Share Linux Terminal Sessions with Screen Utility

Some time it’s required to share a sing terminal sessions with more than one user at the same time when all are working to fix a same issue or doing a same work. In this way all people/users can know what is going on and what commands were issued to fix or finish the job. Also it’s very useful for Linux training sessions. All users/students can watch a single terminal session at the same time to learn. GNU-Screen is a well known utility which allow multiplexing of virtual consoles. In this article I will show you how to use screen utility to share a terminal session.

Sharing between One account:

If multiple users are logged in on a Linux Box using a common account then it’s very easy to share the session between them.

In one terminal issue the below command.

In the above command the word “shared” is your session name.

Then in the other terminal, we have to just attach to that session named “shared” by issuing below command.

It’s only two steps and you are done now all users can see and issue command on a common terminal.

Sharing between two different accounts.

If users logged in with two different accounts, there are some prerequisites to using screen. First, screen must be set SUID and it is necessary to remove group write access from /var/run/screen. The safety of using SUID in this context is something to consider. Then you must use screen’s ACLs to grant permission to the second user.

After this we have to start the screen session on the first user’s terminal. In this example I am using the word “Join” as the session name. We have to turn on multiuser mode and have to add user2 to the ACL, where user2 is the second account.

Then press Ctrl-a to turn the multiuser mode and to add the ACL

We can provide readonly access to the user2 by entering the following ACL Change:

Then in the other terminal, attach to the first user’s session.

Below are Some Use full Screen Commands:

The following two tabs change content below.

Tapas Mishra

Sr. Engineer (DevOps)
Loves to work on Opensource products. Having experience on Linux environment. Knowledge on Public cloud services like AWS, Rackspace, DigitalOcean, Linode. Please don't hesitate to give a comment on the posts. Your comments are my strength.

Leave a Reply