What is the most "Ubuntu" way of preventing certain users from shutting down, suspending etc?
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.
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.