If you have a computer that needs to run 24/7, you probably don’t want the power button to be accidentally pushed and the system to shut down. Here’s how to disable the power off button in a Linux distribution that uses systemd (tested in Proxmox 7.4/Debian 11.6 and Proxmox VE 9.1/Debian 12).
If the /etc/systemd/login.d/ directory does not exist, create it.
Create the /etc/systemd/login.d/power-key.conf file with the following text:
[Login]
HandlePowerKey=ignore
The power button can still be used to power the system on.
If you want a long press of the power key to force the system to power off, add this line to /etc/systemd/login.d/power-key.conf.
HandlePowerKeyLongPress=poweroff

Leave a Reply