Gnu-Screen

如何訪問其他使用者創建的螢幕?

  • November 18, 2020

我以 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.

那麼我應該使用哪個?

除非有問題的螢幕會話是用 創建的multiuser on,否則你不能。即使您將SCREENDIR變數設置為指向其他使用者的套接字目錄,螢幕也會抱怨您不擁有該目錄並在您嘗試使用它時退出。

當然,您可以簡單地su向其他使用者和正常方式使用螢幕。

您可以通過以下方式查看機器上的所有螢幕:

ls -laR /var/run/screen/

這至少會列出帶有螢幕會話的套接字和擁有它的使用者。如果您對套接字具有權限,它還將列出該使用者正在使用的所有螢幕。

這裡

引用自:https://unix.stackexchange.com/questions/219851