Harry Sukumar's Weblog

Archive for February, 2008

How to Stop Non-Privileged users from shutting down or Restarting the Server

Posted by hsukumar on 14/02/2008

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 privileged user will be able to turn off or reboot the machine.

Posted in General Linux | Leave a Comment »