如何透明地使用GNU Screen

时间:2022-09-23 07:51:20

I want to use GNU screen in such a way that the user doesn't know it's there. It's to help ensure that a text based management application that I'm writing can only be used by a single user at a time. To guard against against users locking everyone else out by running the application and going, leaving it running when going on holiday, I want to be able to detach their session and allow another user to attach to it.

我想以这样的方式使用GNU屏幕,用户不知道它在那里。这有助于确保我正在编写的基于文本的管理应用程序一次只能由单个用户使用。为了防止用户通过运行应用程序锁定其他人,并在去度假时保持运行,我希望能够分离他们的会话并允许其他用户连接到它。

So my questions is:

所以我的问题是:

  • Can I set the escape key in .screenrc to null, so that the user can't access any of screen's functionality themselves?
  • 我可以将.screenrc中的转义键设置为null,以便用户无法自行访问任何屏幕功能吗?

4 个解决方案

#1


It looks like the following in .screenrc does the trick:

看起来.screenrc中的以下内容可以解决问题:

escape ''

This does not set the escape character to ', but disables the escape mechanism entirely.

这不会将转义字符设置为',但会完全禁用转义机制。

#2


Maybe just set the escape character in .screenrc to an obscure character from the ASCII table which cannot by typed on a keyboard. I think the character 176 would be an example (or try any other one outside the normal range):

也许只需将.screenrc中的转义字符设置为ASCII表中的一个隐藏字符,该字符不能通过键盘输入。我认为角色176将是一个例子(或尝试在正常范围之外的任何其他人):

escape ^°°

Just put it in your .screenrc file, and your users won't be able to access any screen functionality:

只需将其放在.screenrc文件中,您的用户将无法访问任何屏幕功能:

perl -e 'print "escape ^", chr(176), chr(176), "\n"' >> .screenrc

#3


Preventing the user from using the functionality of Screen is bad form (unless you have a shared login which runs your application).

防止用户使用Screen的功能是不好的形式(除非你有一个运行你的应用程序的共享登录)。

Instead, make your application deal with the use case you've shown by autologout, warning new connecting users and giving them the option to boot the other user, handling multiple users, etc.

相反,让您的应用程序处理您通过autologout显示的用例,警告新的连接用户并为他们提供引导其他用户,处理多个用户等的选项。

#4


instead of using screen, consider using detachtty/attachtty

而不是使用屏幕,考虑使用detachtty / attachtty

#1


It looks like the following in .screenrc does the trick:

看起来.screenrc中的以下内容可以解决问题:

escape ''

This does not set the escape character to ', but disables the escape mechanism entirely.

这不会将转义字符设置为',但会完全禁用转义机制。

#2


Maybe just set the escape character in .screenrc to an obscure character from the ASCII table which cannot by typed on a keyboard. I think the character 176 would be an example (or try any other one outside the normal range):

也许只需将.screenrc中的转义字符设置为ASCII表中的一个隐藏字符,该字符不能通过键盘输入。我认为角色176将是一个例子(或尝试在正常范围之外的任何其他人):

escape ^°°

Just put it in your .screenrc file, and your users won't be able to access any screen functionality:

只需将其放在.screenrc文件中,您的用户将无法访问任何屏幕功能:

perl -e 'print "escape ^", chr(176), chr(176), "\n"' >> .screenrc

#3


Preventing the user from using the functionality of Screen is bad form (unless you have a shared login which runs your application).

防止用户使用Screen的功能是不好的形式(除非你有一个运行你的应用程序的共享登录)。

Instead, make your application deal with the use case you've shown by autologout, warning new connecting users and giving them the option to boot the other user, handling multiple users, etc.

相反,让您的应用程序处理您通过autologout显示的用例,警告新的连接用户并为他们提供引导其他用户,处理多个用户等的选项。

#4


instead of using screen, consider using detachtty/attachtty

而不是使用屏幕,考虑使用detachtty / attachtty