Chapter 6. Changing how your system behaves when you press the power button
When you press the power button on your computer, it shuts down the system by default. You can customize this behavior according to your preferences.
Prerequisites
- Administrative access.
Procedure
-
Open the
/etc/systemd/logind.conf
configuration file. -
Look for the line that says
HandlePowerKey=poweroff
. -
If the line starts with the
#
symbol, remove it to enable the setting. Replace
poweroff
with one of the following options:-
poweroff
to shut down the computer. -
reboot
for a system reboot. -
halt
to initiate a system halt. -
kexec
for a kexec-based reboot. -
suspend
to suspend the system. -
hibernate
to initiate system hibernation. -
ignore
to do nothing.
For example, to reboot the system upon pressing the power button, use this setting:
HandlePowerKey=reboot
-
- Save your changes and close the editor.