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

The Geek Diary

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

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

by admin

The key combination “Ctrl+Alt+Del”, when pressed on a virtual console (black-screen tty), causes the system to reboot. This is the default behavior and sometimes people don’t like this feature as it may cause accidental reboots of the system. The post provides the procedure on how to disable “alt+ctrl+del” key combination in order to prevent an accidental shutdown.

In case of CentOS CentOS/RHEL 4,5 the shutdown command is controlled by /sbin/init, described in /etc/inittab as:

# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now

Follow the steps outlined below to disable the key combination causing the system to reboot on when pressed on a virtual console.

Disabling “alt+ctrl+Del” Key Combination completely for all users

1. comment out the line in /etc/inittab, adding “#” on the top of the line:

# vi /etc/inittab
# ca::ctrlaltdel:/sbin/shutdown -t3 -r now

2. send HUP signal to init(pid=1) to reload /etc/inittab

# kill -HUP 1

Generating a log entry when the “alt+ctrl+Del” key combination is pressed without rebooting

The inittab entry could be modified to run a different (innocuous) command, e.g., logger (to generate a log entry):

# vi /etc/inittab
# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/bin/logger -p authpriv.warning -t init "Console-invoked Ctrl-Alt-Del was ignored"

Restricting the “alt+ctrl+Del” Key Combination to certain users only

1. In addition to above 2 methods, the “alt+ctrl+del” key combination can be restricted to certain users only. Add the -a option to the shutdown command on the referenced line in /etc/inittab, i.e.:

# vi /etc/inittab
# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now -a

2. Populate a new /etc/shutdown.allow file with users (one per-line) which should be allowed to use Ctrl-Alt-Del, e.g.:

# cat /etc/shutdown.allow 
user01
user02

Using the above example, if “Ctrl-Alt-Del” is pressed from a virtual console (one of the black-screen ttys), it will only trigger a shutdown if the users root, user01, or user02 are logged in.

3. After doing this, tell the init process to re-read /etc/inittab via use of the command:

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

Filed Under: CentOS/RHEL 4, CentOS/RHEL 5, Linux

Some more articles you might also be interested in …

  1. How to (Correctly) Change the UID and GID of a user/group in Linux
  2. “map in use” error while removing multipath device in CentOS/RHEL
  3. getenforce: command not found
  4. How to Configure rsyslog Server to Accept Logs via SSL/TLS
  5. How to change the PATH variable in Linux
  6. ifconfig Command Examples in Linux
  7. How to automate sftp file transfers using expect utility
  8. TCP Wrapper (hosts.allow & hosts.deny) Command Options in Linux
  9. How To Disable Or Extend System Logging Rate-limit on CentOS/RHEL 6
  10. larasail Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • nixos-container : Command Examples in Linux
  • nitrogen Command Examples in Linux
  • nitrogen: command not found
  • nft: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright