0

After the user logged in and before he ran the GNU Screen,

[root@15inch ~]# w
 11:45:17 up  3:44,  2 users,  load average: 0,00, 0,02, 0,00
USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT
user  pts/2     09:42    7.00s  0.03s  0.03s -bash
[root@15inch ~]# who
user  pts/2        2018-08-31 09:42 (192.168.1.136)
[root@15inch ~]# 

but after it run GNU Screen I saw nothing:

[root@15inch ~]# w
[root@15inch ~]# who
[root@15inch ~]#

only who --all shows something:

# who --all
           system boot  Aug 31 08:01
LOGIN      tty1         Aug 31 08:01               548 id=tty1
           pts/2        Aug 31 09:42              3068 id=ts/2  term=0 exit=0

the pts/2 is pseudo TTY that was created after his login via ssh. But when I try to send message to him:

[root@15inch ~]# write user pts/2
write: user is not logged in on pts/2

only direct usage of pts/2 works:

[root@15inch ~]# echo "HI" > /dev/pts/2 
[root@15inch ~]# 

is this expected behavior? Why GNU Screen hide this user from system utils?

  • Is the user actually still logged in? If you exit screen can you message them? – Eric Renouf Aug 31 '18 at 10:43
  • @EricRenouf yes, use still logined in. And if user detach GNU screen, w / who starts to see him. If he attach screen session again screen -rd then he again "disapper". – user1244932 Aug 31 '18 at 12:33
2

It's a legitimate feature, although I don't exactly know the original reason for it. I would guess that Screen removes the 'outer' tty from utmp because it's no longer relevant – as long as you're "attached", for most intents and purposes you're not really interacting with the 'outer' tty.

Normally it doesn't cause problems because Screen should add utmp entries for each inner pty (corresponding to each screen window). You should be seeing entries with hostnames like ":S.0" or "<originalhost>:S.0" in the who -a output.

If this does not happen, make sure the window is marked as "logged in"; try Ctrl+AShift+L to toggle the login state. (The default state is set using deflogin on in ~/.screenrc or the system-wide screenrc.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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