Screen Sharing, CLI Style

Date January 23, 2008

Windows users can use RDP or VNC for tech support, troubleshooting, or presentations — as well as the myriad services available commercially over the web. For graphical purposes, Linux folk also have the option of remote X11 or VNC. But what about command line screen sharing on a machine with no X server installed? What if the only immediate access you and your partner share is ssh?

The extremely useful GNU screen program comes to the rescue. Along with its many other uses, screen allows you to share a session with another user logged in via the shell. This can be useful for troubleshooting or demonstrating commands and techniques to one another.

If you are both able to login or become the same user, things are simple. Simply start a screen session, and have the other user attach:

$ screen
-- Second user executes:
$ screen -x

If you are separate users, you’ll need to turn on multiuser mode, and then explicitly allow the users to connect. Unfortunately, if the connecting user is not root, screen will need to run suid:


-- Set UID root on screen - must be done as root
# chmod u+s /usr/bin/screen

-- As user, begin screen session and turn on multiuser
$ screen
$ [control-a] :multiuser on
$ [control-a] :acladd username-to-allow

-- Second user executes:
$ screen -x yourusername/

Control-A is the escape sequence for screen; it precedes all commands. Control-A and then D is used to detach a screen process, for example. Control-A on its own brings you to screen’s command line where you are able to enter the multiuser and acladd commands.

Once the user has attached with screen -x you are sharing the same shell.

There you have it, screen sharing — command line style.

6 Responses to “Screen Sharing, CLI Style”

  1. JJ Noakes said:

    I like kibitz much better – it doesn’t require the same account, and it doesn’t require any tricks to get two different users using the same tty.

  2. mshade said:

    Kibitz is nice too, but it’s also not widely installed. Sometimes you don’t have the time nor option to install a certain package when the need for this arises. Screen is nearly universal… though not to the point of vi for example.

  3. Pádraig Brady said:

    Thanks, screen rocks!
    I previously documented various ways to share terminals with screen

  4. links for 2008-01-25 « Mike Does Tech said:

    [...] Screen Sharing, CLI Style | Tip o’ the Day (tags: screen) [...]

  5. igor said:

    http://www.livelook.net – easy way to share screen (windows/mac/linux) without installing any software

  6. pballer2oo7 said:

    good luck getting livelook to do you any good at a CLI