0

Every user or everyone it Guest Session can reboot computer. I want that Only root can reboot or power off computer. And about button of power off. Button must to be disabled. What I must do?

  • 5
    If you have physical access to computer, you can always reboot it by pressing reset button, or power button. This restriction makes no sense at all. – Pilot6 May 19 '15 at 13:29
  • 2
    Likely duplicate of http://askubuntu.com/questions/93542/how-to-disable-shutdown-reboot-suspend-hibernate – javabrett May 19 '15 at 13:32
  • @javabrett I doubt it, this here is expressly about the guest account. – guntbert May 19 '15 at 16:29
  • @Pilot6 I want nobody else root could reboot or power off computer. And button must be disabled. – Ibragim Ramazanov May 21 '15 at 10:55
  • You can't do it by software. There are hardware reboot and power buttons. You need to disconnect them. And also make power cord and fuses safe ;-) – Pilot6 May 21 '15 at 10:57
  • @Pilot6 I can destroy button) and turn on computer with WOL. Main problem about users. Only root will be use reboot and shutdown nobody else. – Ibragim Ramazanov May 21 '15 at 11:05

1 Answers1

0

If you want to disable to the GUI shutdown/reboot options, use Polkit policies. Create a .pkla file in /etc/polkit-1/localauthority/50-local.d (say 00-disable-shutdown.pkla) containing:

[Disable Shutdown, etc.]
Identity=unix-user:*
Action=org.freedesktop.login1.reboot;org.freedesktop.login1.reboot-multiple-sessions;org.freedesktop.login1.power-off;org.freedesktop.login1.power-off-multiple-sessions;org.freedesktop.login1.suspend;org.freedesktop.login1.suspend-multiple-sessions;org.freedesktop.login1.hibernate;org.freedesktop.login1.hibernate-multiple-sessions
ResultAny=no
ResultInactive=no
ResultActive=no

You can add further sections which allow specific users or groups to use the buttons, or you can instead use unix-user:guest-* to specifically restrict guest users (whose names are usually guest- followed by a random string).

The button will still be present, but a shutdown/reboot option won't be:

enter image description here

See this bug.

muru
  • 197,895
  • 55
  • 485
  • 740