0

I configured one of the PCs to act as a server. It will be used by other emloyees as well via the guest account. Obviously I don't want the PC to be shut down by any user. Also I have to shut it down before I leave every day. Is there a way by which I can confgure it to ask for username/password of an admin account whenever someone tries to shut down the PC?

I am running Ubuntu 14.04/Unity.

daltonfury42
  • 5,499

1 Answers1

0

You can use Polkit rules to control the GUI shutdown privileges (the shutdown command isn't affected, and needs root as usual). A set of rules like in this answer should do. Create a .pkla file in /etc/polkit-1/localauthority/50-local.d/ (say 00-disable-shutdown.pkla):

[Disable Shutdown, etc. for all users]
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=auth_admin

The auth_admin policy will require that an administrative user (by default, members of the sudo group) authorize it.

muru
  • 197,895
  • 55
  • 485
  • 740