Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

On a traditional Unix system, non-root users cannot do this. What is it that gives users this ability in modern desktop environments and how would I go about disabling this on a per-user or per-group basis?

I've seen a great method to prevent anybody from shutting down/suspending, but ideally what I'm looking for is to prevent certain users (such as, by adding/removing them from a certain usergroup) from being able to execute a shutdown, restart, suspend.

share|improve this question

1 Answer 1

up vote 19 down vote accepted

As mentioned in the other question, you can control these actions via PolicyKit's local authority system.

If you create a file /etc/polkit-1/50-local.d/restrict-shutdown.pkla with content like:

[Disable shutdown/etc for group restricted]
Identity=unix-group:restricted
Action=org.freedesktop.consolekit.system.stop;org.freedesktop.consolekit.system.restart;org.freedesktop.upower.suspend;org.freedesktop.upower.hibernate
ResultAny=no
ResultInactive=no
ResultActive=no

This will prevent any member of the group restricted from performing the matched actions. Alternatively, if you want to restrict individual users, replace unix-group:restricted with unix-user:user1;unix-user:user2;.... Any user not matched by this policy should end up with the default behaviour.

share|improve this answer
    
Great answer and explanation, thanks –  neon_overload May 4 '12 at 2:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.