On my system users can reboot and shut down the system. From time to time I need to update software (or do anything else) and I don't want users to reboot/shutdown the system until I've finished.
Is there a way to prevent system from rebooting/shutting down while root is logged in (locally or over SSH)?
Best Answer
Try Molly guard:
This package will prevent unintended shutdown/reboot/suspend/hibernate by interactively prompting you to enter the hostname of the system.
However, it's trivial to configure molly-guard to completely disable shutdown/reboot/suspend/hibernate. Simply create an executable file at /etc/molly-guard/run.d/99-prevent-all that has this in it:
(You didn't mention the OS, this is for Ubuntu).
History
If you're curious the term molly-guard is what the cover over a red button is called. See the wikipedia article on Big Red Button if you're curious.
excerpt
Other distros
You can take the
.deb
package and usealien
to convert it to an RPM suitable for Fedora/RHEL/CentOS.