Friday, March 26, 2010

Disable power button on Ubuntu server

Power button

My little daughter loves to press buttons. Some of her favourite toys are my spare mouse and keyboard. I think she's going to be a computer geek, like her daddy. Unfortunately, my small headless Ubuntu server (and its glowing green power button) is also within her reach. Couple times during this week I've received a message from Monit that it was going down, a rare event, unless your kid just shutdown your entire server, again…

Fortunately, this problem is quite easy to fix. On Ubuntu and other Debians all you have to do is edit /etc/acpi/ script (part of the acpid package) and comment out one line, like so:

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

This would prevent the triggered ACPI power button event from calling  shutdown command.