Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I use screen, and sometimes I'm forced to share it. How I can manage the active connections to my screen?

I would like to monitor connections and users connected, where they are and what they do. Also I would like to be able to kick them out.

Is this possible?

thanks.

share|improve this question
    
You might want to mention this is GNU screen as this is confusing with the computer screen. –  JavaRocky May 10 '10 at 12:04

2 Answers 2

up vote 2 down vote accepted

It's so simple!

Press Ctrl-A * to see the list of connected users to your screen session as well as the screen they're on.

The acldel command can be used to remove another user's rights to your screen session - this will kick him out as well.

share|improve this answer

You can tell which screen processes are linked to ttys by looking at the output of lsof: if a screen client process is connected to the screen interaction processes, then they will share tty devices. So for instance, with:

cas hax$ lsof -n | grep screen | grep tty
screen     1979  cas    3r    FIFO       14,2        0t0  7511093 /private/tmp/uscreens/S-cas/1979.ttyp3.calchas
screen     1979  cas    5r    VREG       14,2       2271     3155 /private/etc/ttys
screen     2298  cas    0u    VCHR        4,3  0t1443440 20004228 /dev/ttyp3
screen     2298  cas    1u    VCHR        4,3  0t1443440 20004228 /dev/ttyp3
screen     2298  cas    2u    VCHR        4,3  0t1443440 20004228 /dev/ttyp3
screen     2299  cas    3u    VCHR        4,3     0t3992 20004228 /dev/ttyp3
screen     2299  cas    4r    FIFO       14,2        0t0  7511449 /private/tmp/uscreens/S-cas/2299.ttyp3.calchas
screen     2299  cas    5r    VREG       14,2       2271     3155 /private/etc/ttys

We see that there is one interaction scree process, 2298, which has /dev/ttyp3 open. Process 2299 also has this tty open, but process 1979 does not access any tty. So you can infer from this output which child processes are talking to which interaction processes.

share|improve this answer
    
Is it possible that in my case your tty is called pts? screen 8011 admmarc 0u CHR 136,44 46 /dev/pts/44 screen 8011 admmarc 1u CHR 136,44 46 /dev/pts/44 screen 8011 admmarc 2u CHR 136,44 46 /dev/pts/44 –  marc.riera May 10 '10 at 16:18
    
Sorry about the parsing, I think it cannot be works. –  marc.riera May 10 '10 at 16:19
1  
@marc: If your linux runs udev -as it does- then it puts the pty slave nodes in /dev/pts. From your lsof output, process 8011 is the interaction screen process: you haven't listed any child screen processes of this interaction process. –  Charles Stewart May 11 '10 at 7:37
    
Thanks for sharing your knowledge. :) –  marc.riera May 17 '10 at 15:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.