5

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?

1

2 Answers 2

0

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.

0

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.

Not the answer you're looking for? Browse other questions tagged .