I've run into the problem where I have users logging in to servers under customer accounts, opening a screen session as that user, and then never closing it. Ordinarily this wouldn't be much of a concern, however we're running into an issue where if a customer is migrated off the server [which deletes their user account] with an active screen session under their username that screen session sits idle. While that's still not much of a problem there is yet another step in this clustercuss.
If a client that was previously resident on a server, which has an old screen session still active, is migrated back to the server screen refuses to start because
/var/run/screen/S-username still exists and is owned by the old UID, and the user [with a spanking new UID] isn't allowed to touch any of these files in their named directory.
- Simply killing the screen processes, but that does not clean up
- To find some combination of
screenarguments that will let me gracefully kill these sessions, but screen does not want to let me touch anything but the current user's sessions, even if I'm logged in as root.
sudo -u '#uid' screen -rbut sudo will not let you do anything if you specify a nonexistant UID.
How can I make screen shut down properly and clean up all of its files when the user no longer exists?