I'm on Debian-Lenny.

I want to change the action taken by the system when the power button is pressed. How do I modify the system such that it does not power off when it gets an Power Button ACPI event?

(My server is in my room, and I don't want my girlfriend to power off my server by pressing the physical power button.)

How can I achieve that?

  • 12
    Upgrade your girlfriend to a geek model. Seriously, just talk to her ;) – MikeyB Jan 25 '11 at 17:15
  • 2
    (I know this is meta, but to the people voting for close - this is a great example of a question that can be rewritten to be more generic and applicable to anyone running a Linux server.) – MikeyB Jan 25 '11 at 17:27
  • Plus One to MikeyB! Haha! Good one! – Mister IT Guru Jan 25 '11 at 17:27
  • 3
    Its actually really good advice. Educate her about servers, it'll go a long way. Yesterday on an NCIS episode someone picked a laptop up by the screen and my wife just shrieked. I was so proud :) – Sirex Jan 25 '11 at 18:35

To change the actions that the server takes when it receives an ACPI event indicating the power button, edit the: /etc/acpi/powerbtn.sh script.

This will not prevent holding the button to force power off, however.

While we're at it, the line in /etc/inittab:

ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now

Controls the action taken upon pressing C-A-D.

  • For the Ctrl-Alt-Del, I won't care very much as my server has no keyboard. But thanks for the powerbtn.sh script location. – Jonathan Rioux Jan 25 '11 at 18:30
  • Just to note: current testing/unstable does not use this script, but have it for users in /usr/share/doc/acpid/examples/powerbtn.sh. – pevik Sep 12 '13 at 6:56

Although you can catch a power button press through ACPI, you can't prevent your girlfriend from pressing and holding the button (to force power down), or from pulling the plug on your server.

My best suggestion is to talk to your girlfriend. Communication is key ;)

  • I've just seen this kind of answer for the first time in Stack*. Perhaps many say this answer should be a comment and I agree with them but PERSONALLY I like this answer. – ynn Jul 20 '20 at 16:24

Old topic, but can be useful to update

In Debian Stretch (and possibly after Wheezy) power manager is managed by systemd config files. So, for instance, to change the behavior of PowerButton press from 'power off' to 'suspend', edit the file /etc/systemd/logind.conf and change the follow line from




and restart the service with

systemctl restart systemd-logind.service

A good ref is the ArchLinux link posted by @allen


I found these instructions for ArchLinux which also apply for most distributions. If none of it is applicable just search with a bias to your particular distribution. It's a common enough question. You will have to tailor it depending on your desktop environment as well.

Instead of the action being /usr/sbin/shutdown, write a simple script to pop up a notification on the screen that says something to the effect of "Hey Girlfriend, don't you do me like that. I dun told you!" The script might be in Python using the DBus interface to libnotify.


Pu in a nuclear battery.

Seriously, you can not. And if you manage, she will pull the plug.

The power plug on a computer is on the power supply and is a physical switch. Note that 2turn off on gfront" is not the power button, but puts the computer technically into standby. As you come to a system administrator website, opposed to superuser.com, I assume you know that.

Now, how would you suggest you can keep a power supply running when you PHYSICALLY DISCONNECT it from the power grid, which is what the power button on the power supply does.

Hint: not possible.

  • 2
    Many systems these days do not have any power buttons or switches other than the one hooked up through ACPI. Your answer is basically a decade out of sync. Also, it's kind of rude, not to mention partly incoherent. – mattdm Jan 25 '11 at 18:24
  • She cannot pull the plug because iv screwed it into the server case. – Jonathan Rioux Jan 25 '11 at 18:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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