Prevent a non-root user from shutting down or rebooting the system

April 20, 2005
To prevent all non-root users from using the shutdown, reboot or halt commands, do the following :

  1. In the file /etc/X11/gdm/gdm.conf , change the line that reads :
    SystemMenu=true
    to
    SystemMenu=false
  2. In the file /etc/inittab, change the line that reads :
    ca:ctrlaltdel:/sbin/shutdown -t3 -r now
    to
    ca:ctrlaltdel:echo "You are not authorized to turn off the machine"
  3. In the directory /etc/security/console.apps/, delete the file reboot, poweroff and halt.
  4. Remove the file /usr/bin/poweroff

Now only the root user will be able to turn off or reboot the machine.

0 comments: