A practical look at the Screen terminal multiplexer

Slashdot it! Delicious Share on Facebook Tweet! Digg!

Multiuser Mode

An interesting Screen feature is multiuser mode, which can be helpful if someone is stuck with a problem and needs some help on the command line. Screen can be enabled for multiuser mode from the beginning of a session by including the -m parameter with the start command, or during a running Screen session you can use Ctrl+A and then Shift+. to open a screen command line. Use

:multiuser on

to activate multiuser mode. You then determine which user can participate with Ctrl+A and Shift+. and the instruction

:acladd username

By default, the added user can do anything, but this can easily be changed using the following:

:aclchg username permbits list

which can also take multiple usernames in the syntax. The permbits are rwx for reading, writing, and executing, as you are probably familiar with from the Bash chmod command. You set the bits with pluses and minuses for "allow" and "deny," respectively. The list is the window or windows the user can access. To give user Fred only read privileges in window 1, for example, you would type

:aclchg fred -w 1

replacing the list with "#" provides access to all session windows.

With all the privileges set, users log in with their accounts and enter the session for the original user (e.g., otto ) with

$ screen -x otto

With multiple sessions, the PID or name of the session needs to be entered after the slash. To get the PID, use

$ screen -ls user

See Figure 5. You may also need to set the suid bit for Screen and make /var/run/screen readable for multiuser mode to work properly. You can do this on the command line with

$ chmod u+s /usr/bin/screen

or

chmod 755 /var/run/screen

When the Screen guests are through, you can use acldel username to remove their privileges. Turning off multiuser mode isn't enough, however: Anyone logged in to the session can stay with it until removed.

Figure 5: If a user started many multiuser sessions, Screen guests can obtain a list.

Terminal Emulator

Screen doesn't just act like a flexible terminal multiplexer; it can also act like a serial communication program. You can therefore get the output from an Arduino, for example, or any other device with a serial console, even if you can't normally start it up from Screen.

The default Screen setting for transmission is 115200 bps, 8 bits, no-stop bit, and deactivated flow control. Apart from the baud rate, this default setting should suffice for most devices. For example, to connect to a striking GuruPlug, use the following (Figure 6):

$ screen screen /dev/ttyUSB0

You can use:

$ screen /dev/ttyUSB0 9600

to get the serial output from an Arduino with a standard 9600 bps setting.

Figure 6: Screen also serves as a serial communication program.

Buy this article as PDF

Express-Checkout as PDF

Pages: 4

Price $0.99
(incl. VAT)

Buy Ubuntu User

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content