To prevent all non-root users from using the shutdown, reboot or halt commands, do the following :
- In the file /etc/X11/gdm/gdm.conf , change the line that reads :
toSystemMenu=true
SystemMenu=false
- In the file /etc/inittab, change the line that reads :
toca:ctrlaltdel:/sbin/shutdown -t3 -r now
ca:ctrlaltdel:echo “You are not authorized to turn off the machine”
- In the directory /etc/security/console.apps/, delete the file reboot, poweroff and halt.
- Remove the file /usr/bin/poweroff
Now only the privileged user will be able to turn off or reboot the machine.