How do I prevent a non-root user from shutting down, rebooting, or halting the system?
Issue
The steps to follow to prevent non-root users to shutdown/reboot/halt the server are:
-
In the file
/etc/X11/gdm/gdm.conf, change the line that reads:SystemMenu=true to SystemMenu=false -
In the file
/etc/inittab, change the line that reads:ca::ctrlaltdel:/sbin/shutdown -t3 -r now to ca::ctrlaltdel:echo <A message indicating rebooting is not possible> -
In the directory
/etc/security/console.apps/, remove the files: reboot, poweroff, and halt. To remove files, use thermcommand. Example:rm /etc/security/console.apps/poweroff. -
Remove the file
/usr/bin/poweroff
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
