Allow use of screen without ability to detach sessions
I'm wondering if this is possible. I'd like users to be able to launch screen on some of our hosts for the purpose of multiplexing their terminal login sessions. However, I don't want them to be able to detach the screen and leave it running in the background.
The reason for this being that the only way to log in to these machines is through a cluster job submission system, so if a screen becomes detached and the user logs off the only way to get back would be if they happened to land back on the same node on their next job submissions.
Solution 1:
echo autodetach off >> ~/.screenrc
Read the screen manpage for autodetach. This will make sure it simply kills everything if their connection is disabled.
You'll still want the other solutions mentioned...
Solution 2:
You can do a 'soft' disable of detaching by putting
bind d
in .screenrc
, which removes the default ^A D keybinding for detach. Or maybe
bind d echo Don't detach screens, it won't work because of the cluster.
Doing a hard disable of detach, including the command line forms, would take forking your own version of screen
and coding out the capability. Which, y'know, can be done, it being an open source project and all.