Info
Content

Disabling the physical power switch in Linux


You may wish to disable the physical power switch on your (dedicated) server, so no action is taken if it is ever physically pushed.
Underneath are steps required to disable this.

Systems using acpid:

Edit the following file using your favourite file editor, in the example below nano is used.

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

Locate the following lines,

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

If you wish for the power button to be ignored, simply remove the action.
It should now look as follows,

event=button[ /]power
action=

To allow the changes to take effect, either restart the acpid service or reboot the operating system.

service acpid restart
Systems using systemd-login:

Edit the following file using your favourite file editor, in the example below nano is used.

nano /etc/systemd/logind.conf

Locate the following line,

#HandlePowerKey=poweroff

If you wish for the power button to be ignored, uncomment the line and replace 'poweroff' with 'ignore'. If the line does not exist yet, you may simply add it.
It should now look as follows,

HandlePowerKey=ignore

To allow the changes to take effect, either restart the systemd-logind service or reboot the operating system.

service systemd-logind restart
No Comments
Back to top