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 Ctrl+Alt+Del causing system reboot in CentOS/RHEL 6