如何访问其他用户创建的屏幕?

如何访问其他用户创建的屏幕?

我以 root 身份登录,无法看到其他人使用screen -ls.我认为 root 用户可以访问这些屏幕,但我找不到有用的屏幕选项:

Use: screen [-opts] [cmd [args]]
 or: screen -r [host.tty]

Options:
-4            Use IPv4.
-6            Use IPv6.
-a            Force all capabilities into each window's termcap.
-A -[r|R]     Adapt all windows to the new display width & height.
-c file       Read configuration file instead of '.screenrc'.
-d (-r)       Detach the elsewhere running screen (and reattach here).
-dmS name     Start as daemon: Screen session in detached mode.
-D (-r)       Detach and logout remote (and reattach here).
-D -RR        Do whatever is needed to get a screen session.
-e xy         Change command characters.
-f            Flow control on, -fn = off, -fa = auto.
-h lines      Set the size of the scrollback history buffer.
-i            Interrupt output sooner when flow control is on.
-l            Login mode on (update /var/run/utmp), -ln = off.
-list         or -ls. Do nothing, just list our SockDir.
-L            Turn on output logging.
-m            ignore $STY variable, do create a new screen session.
-O            Choose optimal output rather than exact vt100 emulation.
-p window     Preselect the named window if it exists.
-q            Quiet startup. Exits with non-zero return code if unsuccessful.
-r            Reattach to a detached screen process.
-R            Reattach if possible, otherwise start a new session.
-s shell      Shell to execute rather than $SHELL.
-S sockname   Name this session <pid>.sockname instead of <pid>.<tty>.<host>.
-t title      Set title. (window's name).
-T term       Use term as $TERM for windows, rather than "screen".
-U            Tell screen to use UTF-8 encoding.
-v            Print "Screen version 4.00.03 (FAU) 23-Oct-06".
-wipe         Do nothing, just clean up SockDir.
-x            Attach to a not detached screen. (Multi display mode).
-X            Execute <cmd> as a screen command in the specified session.

那么我应该使用哪个?

答案1

除非有问题的屏幕会话是使用 创建的multiuser on,否则您不能。即使您将SCREENDIR变量设置为指向其他用户的套接字目录,屏幕也会抱怨您不拥有该目录,并在您尝试使用它时退出。

当然,您可以简单地su向其他用户并以正常方式使用屏幕。

答案2

您可以通过以下方式查看机器上的所有屏幕:

ls -laR /var/run/screen/

这至少会列出具有屏幕会话的套接字以及拥有它的用户。如果您拥有套接字的权限,它也会列出该用户正在使用的所有屏幕。

这里

相关内容