Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

13.11. Changing Behavior when Pressing the Power Button in Graphical Target Mode

When the machine is booted to a graphical login screen or user session, hitting the power button makes the machine suspend by default, in Red Hat Enterprise Linux 7. This happens both in cases when the user presses the power button physically or when pressing a virtual power button from a remote console. To achieve a different behavior when pressing the power button, set the functions of particular buttons with dconf.
This section shows how to configure the system to shutdown after pressing the power button, which corresponds to the behavior present in Red Hat Enterprise Linux 6.

Procedure 13.11. Setting the behavior when pressing various buttons

  1. Create a local database for system-wide settings in the/etc/dconf/db/local.d/01-power file:
    [org/gnome/settings-daemon/plugins/power]
    button-sleep='nothing'
    button-suspend='nothing'
    button-hibernate='nothing'
    button-power='shutdown'
    
  2. Override the user's setting and prevent the user from changing it in the /etc/dconf/db/local.d/locks/01-power file:
    /org/gnome/settings-daemon/plugins/power/button-sleep
    /org/gnome/settings-daemon/plugins/power/button-suspend
    /org/gnome/settings-daemon/plugins/power/button-hibernate
    /org/gnome/settings-daemon/plugins/power/button-power
    
  3. Update the system databases:
    # dconf update
  4. Users must log out and back in again before the system-wide settings take effect.
This configuration initiates a system shutdown after pressing the power button. To configure the system differently, you can set the behavior of particular buttons.

Options for particular buttons

blank
does nothing
interactive
shows a pop-up query asking the user what to do
hibernate
hibernates the system
logout
terminates the session and logs the user out
nothing
does nothing
shutdown
starts a standard shutdown procedure
suspend
suspends the system