You could probably install a handler for the event that’s triggered when the power button is pressed. Most OSes do that and pop up a graceful shutdown options window. Most hardware will have a hard shutdown option when you hold the power button for a few seconds. You would probably have to overwrite the BIOS or something at that level to prevent that way out.
How can you prevent users from leaving a directory?
Magic, I guess, 'cause nothing in the sceenshot would do it, unless the attacker had already replaced
catwith a trojan or something.chroot, and override exit with an alias,could work
AFAIK, there’s no way to without modifying the system tools and shell.
How can you prevent a shutdown using a power key?
There’s an Emacs command to do that
C-x M-c M-minefieldYou could probably install a handler for the event that’s triggered when the power button is pressed. Most OSes do that and pop up a graceful shutdown options window. Most hardware will have a hard shutdown option when you hold the power button for a few seconds. You would probably have to overwrite the BIOS or something at that level to prevent that way out.