If more than one person is logged in on my computer, Ubuntu requires super user authentication when shutting down the computer. How can I make it so that any user can shutdown the computer without being asked for a password?
If more than one person is logged in on my computer, Ubuntu requires super user authentication when shutting down the computer. How can I make it so that any user can shutdown the computer without being asked for a password?
Richard Holloway's answer is not actually the way PolickKit authorisations are meant to be granted. The files installed under
/usr/share/polkit-1/actions
are not meant to be modified. Instead, you should modify the authorities under/etc/polkit-1/localauthority/50-local.d/
.Here's how you do it for this question:
Create a file named
/etc/polkit-1/localauthority/50-local.d/allow_all_users_to_shutdown.pkla
and edit it usingsudoedit
to look like this:Then create another
.pkla
file in the same directory. Use any name you like ending with.pkla
, for example,allow_all_users_to_restart.pkla
, and fill it with these contents:References:
You do not need a workaround, just change the policy to allow you to shut down without authenticating as admin for shutdown and reboot when multiple users are logged in.
Edit the file /usr/share/polkit-1/actions/org.freedesktop.consolekit.policy using your favorite text editor. You will need root permissions.
Change the section relating to shutdown when others are logged in from
to
and the section relating to rebooting when others are logged in from
to
And that will allow you shutdown and reboot the PC when multiple users are logged in. Whether you want to do that is a different question.
There is a better way. If you have dbus-send installed, you can shutdown via dbus without the need to escalate to root privileges.
I can't remember the page where the documentation is, but one Archlinux user figured this out.
Shutdown:
Reboot:
Suspend:
Hibernate:
Regards.
HAL seems to be now depcrecated and not installed in latest Ubuntu releases.
You must use ConsoleKit and UPower dbus services to manage power state
Shutdown:
Restart:
Suspend:
Hibernate:
Thanks to Arch Linux forums.
This works for now in Precise and Quantal, but don't know for how long since the Freedesktop focus seems to be shifted from ConsoleKit to systemd. Don't know whether Canonical cares...
This works on 14.04. An updated variation of the previous, IMO, correct answer by Flimm.
Paste this inside:
There is no way to circumvent the prompt for a superuser password when rebooting while other users are logged in short of opening a terminal window and issuing the
reboot
command as root:Even still, if not configured to bypass password prompting for your user account,
sudo
will also prompt you for your password.Don't worry, these are GOOD things. Rebooting should be rare and a simple admin password prompt saves accidentally hosing yourself!
I believe this is only an issue when doing it through the command line.
If so here is a link that can help with your problem.
Add halt and/or reboot into sudoers file assigned to the group/user you wish to allow to perform this task. That way you can still control who can shutdown, but without giving them full root access to the machine..
http://linux.byexamples.com/archives/315/how-to-shutdown-and-reboot-without-sudo-password/
Apparently, you are able to shut down without root from the GUI because gdm runs as root. Gnome tells gdm to shut down, and gdm does it.
You could do something similar with a script. I'm not sure how handy you are with BASH, but I believe one could write a script that runs as root and, when it receives a certain signal, runs the shutdown command.
Keep in mind that this may pose a security problem.