Shutdown by power button when logged out / screen locked

Hallo,
how can I shut down by pressing the power button, when nobody is logged in or the screen is locked?

BR Oliver.

I have forgotten how Gnome works - but I think in power settings you can control what happens when the power button is pressed.

If the screen is locked - it is assumed that someone is working and shutting down could cause dataloss.

2 Likes

I configured the behaviour of the power switch in the Gnome energy settings already. But it has no effect on lock screen or when logged off.

But this here works:

  • As a root create a file named /etc/acpi/events/power with contents like this:
event=button/power
action=shutdown -h now
  • Then run sudo systemctl restart acpid
  • done

Would like to post the source of this tip, but getting always error 422 after inserting the url.

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.