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. 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 function of this button with dconf.
For example, if you want the system to shutdown after pressing the power button, use the following procedure:

Procedure 13.11. Using dconf to configure the system to shutdown after pressing the power button

  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]
    power-button-action='interactive'
    
  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/power-button-action
    
  3. Update the system databases:
    # dconf update
  4. 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

nothing
does nothing
suspend
suspends the system
hibernate
hibernates the system
interactive
shows a pop-up query asking the user what to do
With interactive mode, the system powers off automatically after 60 seconds when hitting the power button.
However, you can choose a different behavior from the pop-up query as shown in the figure below.
Pop-up query for interactive mode

Figure 13.2. Pop-up query for interactive mode