连接到 GNU Screen 后用户消失

连接到 GNU Screen 后用户消失

在用户登录之后,运行之前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 ~]# 

但运行后GNU Screen我什么也没看到:

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

who --all显示一些内容:

# 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

pts/2是他通过 登录后创建的伪 TTY ssh。但是当我尝试向他发送消息时:

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

仅直接使用 pts/2 有效:

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

这是预期行为吗?为什么GNU Screen要在系统实用程序中隐藏此用户?

答案1

这是一个合法的功能,尽管我并不确切地知道最初的原因。我猜想 Screen 从 utmp 中删除了“外部”tty,因为它不再相关 - 只要您“连接”,在大多数情况下,您实际上并没有与“外部”tty 交互。

通常不会造成问题,因为屏幕应为每个添加 utmp 条目私人有限公司:S.0(对应于每个屏幕窗口)。您应该<originalhost>:S.0输出。

如果没有发生这种情况,请确保窗口标记为“已登录”;尝试Ctrl+AShift+L切换登录状态。(默认状态是使用deflogin on在 ~/.screenrc 或系统范围的 screenrc 中。)

相关内容