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.

Possible Duplicate:
How to shutdown/restart/suspend … without authentication or confirmation?

If shutdown asks for password (and so does every program which has the option to turn off after finishing something), how does the shutdown button work if it does not ask for it?

share|improve this question

marked as duplicate by jrg, htorque, Oli Dec 24 '11 at 16:12

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
same question here askubuntu.com/questions/86138/… –  Naruto Dec 23 '11 at 21:57
add comment

2 Answers 2

A window manager can be configured to ask (like gnome-power-manager), but the system itself does not ask (e.g.: via init or shutdown). Most computers now have an electronic power switch that sends a signal to the computer. The computer receives the signal and does whatever it was configured to do with it.

You didn't say which version. I think... I am not entirely sure, but I think I remember this being slightly different on different versions...

So... what's doing it? Open a terminal...

Is the button kernel module loaded? (lsmod | grep button)

Yes? The kernel is receiving the signal and passing it to another program.

Is acpid running? (ps -A | grep acpi)

Yes? ACPI (Advanced Configuration and Power Interface) handles the signal.

So let's look in /etc/acpi/... You should have a "powerbtn.sh" file or something similar depending on your version of Ubuntu and/or ACPI. At the end of that script you see what happens:

/sbin/shutdown -h -P now "Power button pressed"

And if we do a man shutdown from a terminal, we can see the meaning of switches...

  • -h Halt or power off after shutdown.
  • -P Halt action is to turn off the power.

If you want to configure the button... this seems to be a good post if you are using Gnome. I am fairly certain that this is a version-specific question, but these I hope are good clues.

share|improve this answer
add comment

The password is used from the user to temporary gain privilaged access to the system, and shutting down the computer is a privilaged operation.

On the other hand the press of the button is caught by the kernel, which already has the privilages for the operation.

share|improve this answer
add comment

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