When you click the shutdown button (in Unity):
SessionView asks the
SessionManager if the user is authorized to shutdown.
systemd-logind to check
/org/freedesktop/ConsoleKit/Manager for the authorization.
ConsoleKit sets that property essentially by checking if multiple users are logged in. If multiple users are logged in, it denies authorization. In addition, depending on how the system has been set up,
ConsoleKit may also use
polkit or role-based access control to determine authorization.
SessionView does not receive authorization for the user to shutdown, it changes the action mode from
As an aside, note that this behavior (and how to implement it) is a decision made by Ubuntu. I had recently installed Arch with Gnome 3.8 to a partition, so logged in two users there to see how what happened when one of them shutdown. There was a message warning that other users were logged in and might lose work, but clicking OK let the shutdown continue.
[Edit based on OP comment]
The simplest way to change this behavior is to bypass it. In a terminal or a script, issue:
sudo shutdown -h 0 for immediate shutdown or
sudo shutdown -r 0 for a restart.
This assumes the user who wants to shutdown has administrative privileges, but the user could also be granted admin privilege only for
With a script you cold add in some of niceties like warning about other logged in users and allowing the user to change their mind about shutting down.
Someone else may have another idea (or could likely provide a fleshed-out script in response to a new question), but I can't think of anything easy (say, without recompiling a custom version of Unity) or safe beyond this solution.