Change Behavior of Linux Power Button

terdon's answer is correct in most cases, but for distributions that have adopted systemd-logind it handles power events instead of acpid. On those distributions, add or edit this setting /etc/systemd/logind.conf to disable the power button:

HandlePowerKey=ignore

To pick up the new setting, restart logind with

sudo systemctl restart systemd-logind

On some older distributions logind can't be restarted while a desktop session is active, in which case you'll need to reboot in order to pick up the new setting.


Well, one thing you could do is simply disable the power button altogether. Personally, I only use it to turn on my machine, and never use it once the machine is on. If this is an OK solution for you, edit /etc/acpi/events/powerbtn-acpi-support:

sudo nano /etc/acpi/events/powerbtn-acpi-support

That file should look something like this:

event=button[ /]power
action=/etc/acpi/powerbtn-acpi-support.sh

To make the power button do nothing, change it to:

event=button[ /]power
action=

Then restart the acpi daemon with

sudo service acpid restart

Your power button should now be ignored.


Duct-tape a cardboard guard over the button. Take three pieces of corrugated cardboard, and cut a hole in each large enough for your finger to reach through to the button. Glue them together, with the hole aligned, then duct tape the assembly around the button. All hail our feline overlords!