• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to disable “Alt+Ctrl+Del” causing system reboot in CentOS/RHEL 7

By admin

Have you tried pressing the key combination “Alt+Ctrl+Del” on CentOS/RHEL system? Well, Don’t try it if you don’t know what it does. The key combination “Alt+Ctrl+Del” will reboot your CentOS/RHEL server. For earlier version like CentOS/RHEL 6 the file that causes init to handle Ctrl-Alt-Del was /etc/init/control-alt-delete.conf.

In CentOS/RHEL 7, /etc/init/control-alt-delete.override no more works to override the key combination. The post provides the procedure to disable “alt+ctrl+del” key combination in order to prevent an accidental shutdown.

Masking the ctrl-alt-del.target Target

1. If requirement is to disable the “ctrl+Alt+delete” key combination, one need to mask a service. This is like disabling a service. Run the following command:

# systemctl mask ctrl-alt-del.target

or

# ln -sf /dev/null /etc/systemd/system/ctrl-alt-del.target

2. systemd will recognize units symlinked to /dev/null and show them as masked. If one try to send key combination, this will fail with following similar error.

June 9 02:33:43 geeklab systemd: Failed to enqueue ctrl-alt-del.target job: Unit ctrl-alt-del.target is masked.

3. However, above steps will not disable “ctrl+Alt+delete” key combination, in GUI mode. To disable it in GUI change keyboard settings.

Navigate to  Applications -> System Tools -> Settings -> Keyboard  -> Shortcuts -> System 
Set value of "Logout" as Disabled

Unmasking the ctrl-alt-del.target Target

To unmask the ctrl-alt-del.target Target and revert back, run the following command:

# systemctl unmask ctrl-alt-del.target

Disabling “ctrl-alt-del.target Target” in GUI mode, using CLI

Use the steps below to disable the “Alt+Ctrl+Del” key combination in GUI, using CLI.

Disabling per user

1. We need to check the value of “DBUS_SESSION_BUS_ADDRESS” environment variable from the already logged in GNOME. For example, a `testuser` has already logged in to the GNOME, and form the GNOME terminal, we use the following command:

$ env | grep DBUS_SESSION_BUS_ADDRESS
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-3UIRkKkjAU,guid=15771e3a5dcb3a7b2c151d00566a2dda

2. Mark down the output and then turn to the ssh session and export it:

$ export DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-3UIRkKkjAU,guid=15771e3a5dcb3a7b2c151d00566a2dda

3. Now we can use gsettings to set the value of the key:

$ gsettings set org.gnome.settings-daemon.plugins.media-keys logout ''

4. Check if the key is successfully modified:

$ gsettings get org.gnome.settings-daemon.plugins.media-keys logout
''

Disabling for all users

1. Create a file under the directory ‘/etc/dconf/db/local.d/‘ with the settings to be applied globally. For example:

# cat /etc/dconf/db/local.d/00-disable-CAD 
[org/gnome/settings-daemon/plugins/media-keys]
logout=''

2. Update the dconf settings:

# dconf update

Verify if the ‘ctrl-alt-del’ key combination is disabled globally.

How to disable Ctrl+Alt+Del causing system reboot in CentOS/RHEL 6
How to Disable “alt+ctrl+Del” Key Combination causing reboot in CentOS/RHEL 4,5

Filed Under: CentOS/RHEL 7, Linux, OEL 7

Some more articles you might also be interested in …

  1. Swapon Fails To Mount Swap – Gives Invalid Argument Error
  2. How to configure apache virtual host on ubuntu
  3. How to Make User Account Read-Only in CentOS/RHEL 7
  4. RPM command examples to query, install, remove and upgrade packages
  5. Active FTP vs. Passive FTP
  6. How To Send Mails To an External User With Mailx on Linux
  7. How to Re-Create the Yum Cache and/or Force a Fetch of the Package List of the Enabled Repositories
  8. How to Configure Persistent Names for Tape Devices in CentOS/RHEL
  9. lvremove failing to remove volume after using ‘shred’ command
  10. CentOS / RHEL LVM : Backing Up Volume Group Metadata

You May Also Like

Primary Sidebar

Recent Posts

  • Basics of client connectivity in Oracle Data Guard configuration
  • ORA-354 ORA-353 and ORA-312: Possible corruption in Online Redo Log File Members in a Redo Log Group
  • How to relocate the redo log files to a different location on disk
  • Oracle Database: Redo log operations (Add/Drop/Change Location)
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary