当套接字存在但屏幕不使用它时,如何重新连接到屏幕会话?

当套接字存在但屏幕不使用它时,如何重新连接到屏幕会话?

我见过这个问题这个问题,但它们都不适用于我。我在 /var/run/screen 中有一个套接字文件,并且我拥有它 - 但 screen -list 无法识别它并允许我连接。我该如何恢复此会话?

tom@host~ $ ls /var/run/screen/S-tom/
total 0
prw------- 1 tom people 0 Jul  2 19:07 3954.pts-0.host

tom@host ~ $ screen -list
No Sockets found in /home/tom/.screen.

答案1

您可以将SCREENDIR环境变量设置为/var/run/screen。然后您应该能够列出并连接。

假设sh兼容的 shell:

export SCREENDIR="/var/run/screen"

man 1 screen

ENVIRONMENT
   COLUMNS        Number of columns on the terminal (overrides termcap entry).
   HOME           Directory in which to look for .screenrc.
   LINES          Number of lines on the terminal (overrides termcap entry).
   LOCKPRG        Screen lock program.
   NETHACKOPTIONS Turns on nethack option.
   PATH           Used for locating programs to run.
   SCREENCAP      For customizing a terminal's TERMCAP value.
   SCREENDIR      Alternate socket directory.
   SCREENRC       Alternate user screenrc file.
   SHELL          Default shell program for opening windows (default "/bin/sh").
   STY            Alternate socket name.
   SYSSCREENRC    Alternate system screenrc file.
   TERM           Terminal name.
   TERMCAP        Terminal description.
   WINDOW         Window number of a window (at creation time).

相关内容