How to Share virtual terminal SSH between mutliple logged in users with screen / Create multi user sessions with GNU screen

How to share bash shell between multiple users with gnu screen - share virtual terminal via ssh  through multiple users screen

GNU Screen is great utility with a number of helpful features. Maybe there is no UNIX / (GNU / Linux),  admin which doesn't use screen or some similar terminal emulator prog. daily basis.

Little might know however abut a kewl functionality allowing, a few logged in users via ssh to share one terminal.

Sharing a virtual terminal with another person, is very helpful if you want to teach someone a bit of Linux / UNIX basics, showing him how certain commands works on a system etc. etc.

Shared terminal session is very helpful in case of need for remote system administration or support, whether instead of explaining someone over the phone for 20 minutes or an hour a bunch of commands he has to run to achieve something,  you can login share terminal with screen and do whatever necessary  in front of his eyes.

Shared screen session, can actually in theory allow unlimited people to watch what a certain one is doing in a his virtual terminal. This is very helpful for example in Computer Laboratories for Teachers to teach students FreeBSD, Linux, bash, csh shell scripting, perl or whatever programming language taught.

Allowing two or more logged in users with same user credentialsto use screen can be done pretty easy, one primary user (creating the initial screen terminal session), should just launch GNU screen:

test@noah:~$ screen

The second, third, 4th, 5th and the rest of users should login via SSH session with same user, lets say test and launch screen -x

test@noah:~$ screen -list
There is a screen on:
    20147.pts-5.noah    ( 1.11.2012 18,27,50)    (Attached)
1 Socket in /var/run/screen/S-hipo.


test@noah:~$ screen -x

I'm not sure if screen has some kind of limitation on how many users maximum can connect to a screen session, but I guess it should be high enough for dozen of people –  at least 512 or 1024 people to connect and share one shell simultaneously.

In some Linux distributions (versions) RHEL, CentOS it is possible screen -x not to work out of the box, because screen binary is not set to be SUID.
On latest Debian versions and deb derivatives thanksfully, screen bin is by default installed as SUID so screen -x works fine.

hipo@noah:~$ ls -al /usr/bin/screen
-rwxr-sr-x 1 root utmp 364088 29 юли  2009 /usr/bin/screen

Enabling mutiuser screen login via a running screen session is possible by pressing:

CTRL + a + : and typing in prompt  multiuser on

In case you want to have a system user which by default allows a multiple logged in users to share shell you can use a little 'hack' just change in /etc/passwd the field recordfor user shell (/bin/bash) with (/usr/bin/screen)

Lets say you want to allow the user test support multiple logged in users share one shell the record for test in /etc/passwd should look smth. like:


Change it with your favourite text editor to:


If you have some problems running screen, check permissions and eventually exec as superuser:

chmod u+s /usr/bin/screen

Share this on:

More helpful Articles

Download PDFDownload PDF

Tags: , , , , ,

One Response to “How to Share virtual terminal SSH between mutliple logged in users with screen / Create multi user sessions with GNU screen”

  1. sergey says:
    Google Chrome 25.0.1364.97 Google Chrome 25.0.1364.97 Windows Vista x64 Edition Windows Vista x64 Edition
    Mozilla/5.0 (Windows NT 6.0; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22

    For Windows:
    I have written Windows Desktop Workspace manager with automated terminal for CYGWIN.
    Each terminal window has built-in TELNET or TELNET-TLS server that allows to share terminal session with remote users via TELNET protocol. Check it out.

    Shared session is persistent and can be accessed from anywhere by TELNET or TELNET-TLS client.

    View CommentView Comment

Leave a Reply

CommentLuv badge