Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using Gnome 3 with Debian Wheezy. I am looking for a way to make the user ask at least for the root password when using the shutdown button from the menu.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

polkit/consolekit can do exactly what you need. Write a new polkit rule:

/etc/polkit-1/localauthority/50-local.d/org.freedesktop.SysPower.pkla

add the following content (assuming you require root password for both shutdown & restart):

[Disable shutdown/restart]
Identity=unix-user:*
Action=org.freedesktop.consolekit.system.stop;org.freedesktop.consolekit.system.restart
ResultAny=no
ResultInactive=no
ResultActive=auth_admin
share|improve this answer
add comment

Change the privileges on the shutdown command in /sbin so that only root (or a member of a group with equivalence) can execute it. You would make the changes via chmod or the file-manager of choice in your distribution. If you did this, in theory you would have to "sudo shutdown -h now" and you would be prompted for the root password. That should work in theory

Another more complicated but better answer:

Step1:
Open /etc/X11/gdm/gdm.conf in a text editor and find the [greeter] section. Make sure that there is a line which says SystemMenu = false. This line will ensure that the gdm login screen will not have the option for shutting down the system etc.

Step 2:
If you have a laptop, or an acpi system on your computer, then go to /etc/acpi and disable the power button, so that, when someone presses the power button, the system does not shutdown. You can disable this easily by doing chmod 000 /etc/acpi/powerbtn.sh

Step 3:
Now edit /etc/inittab

and find the lines that say:

#Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now

And change it to read:

#Disallow CTRL-ALT-DELETE
ca::ctrlaltdel:/bin/echo “ctrl-alt-delete has been disabled” .

This will effectively prevent users from changing to a console screen and using ctrl+alt+delete to shutdown the system.

Step 4:
Execute the following commands:
sudo chgrp admin /sbin/halt /sbin/shutdown
sudo chmod 550 /sbin/halt /sbin/shutdown

Step 5:
Use the Configuration Editor (Applications -> System Tools -> Configuration Editor) to edit the preference apps->gnome-session->options->logout_opt… to “logout” instead of “shutdown”.

Now only a superuser (Admin) can shutdown the system, using the command:
$sudo shutdown -t3 -r now

Got help from here: http://answers.yahoo.com/question/index?qid=20080606143849AAONUy9

share|improve this answer
    
Thank you for your answer. i only need to know how to disable this in the users menu. The other steps are already done. And since i am using GNOME 3 (!!!) there is no entry for gnome-session under apps neither in gconf-editor nor in dconf editor. –  l1zard Jul 24 '12 at 17:58
add comment

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.