h1

Screen

March 9, 2010

Tried using screen today to share a terminal between two developers. This is useful for running background tasks where more than one person wants to check the output occasionally.

One user starts up a screen session and then grants the other user access to it.

To run screen run:

screen -S ScreenSessionName

Where ScreenSessionName can be anything you like.

From within the screen session you can now hit Ctrl^a followed by typing

:multiuser on

Now you can grant access to other users on the same system by typing

:acladd user2

Where user2 is the login name of the other user.  That person can now connect to the same terminal session by typing:

screen -x user1/ScreenSessionName

Where user1 is the login name of the first person who created the screen session.  With both of you in the terminal you can see what the other is typing. To leave the session at any time hit Ctrl^a Ctrl^d.You can reconnect with the screen session by typing:

screen -r user1/ScreenSessionName

When you want to terminate the screen hit Ctrl^a k (Thats Control and a, then release control and hit the k key).

To see what screen sessions are active on a system you can use the command:

screen -ls

Advertisements

One comment

  1. By default, this is not allowed on Debian, even if you turn multiuser mode on, but if you absolutely need this functionality, you can do it this way

    First, make sure, as root:

    1. Your /usr/bin/screen is setuid root. You can do this by running:
    chmod u+s /usr/bin/screen
    but this has quite a significant security implication, which is why this is not Debian’s default setting.

    2. Your /var/run/screen should have 755 permission (again, this is not Debian’s setting (775 permission), as Debian lets setgid and group ownership of screen executable by utmp to handle writing to this system dir). You can do this by running:
    chmod 755 /var/run/screen



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: