How to disable ctrl-alt-del and /etc/init/control-alt-del.conf in Linux?
Solution 1
change in /etc/init/control-alt-del.conf
are taken immediatly.
I tested in ESX and physical hosts.
when I inserted
exec date > /var/log/cad.log
in /etc/init/control-alt-del.conf
and issue Ctrl-AltDel I get date in /var/log/cad.log
.
So no need to reboot.
Solution 2
Since this is the way to enable a function that acts on pressing Ctrl+Alt+Del, it is also the, probably official, point to switch if off.
You should just comment out ('#' in front of the line) the exec shutdown...
and there is no need to insert exec /bin/true
. No need to keep a copy of the file if you just comment things out.
I would reboot the system after the change, as I think it is init itself that reads that file, not some daemon. Just changing the file without further action doesn't have any effect¹.
¹ In the good old days you would set the Ctrl+Alt+Del handling in /etc/inittab
and you could issue a init q
after a change.
Арсений Черенков
When everything else has failed, read the manual, log a call.
Updated on September 18, 2022Comments
-
Арсений Черенков almost 2 years
My OS is RHEL 6.2
I disable Ctrl+Alt+Del by changing in
/etc/init/control-alt-del.conf
the lineexec /sbin/shutdown -r now "Control-alt-del pressed"
by
exec /bin/true
I'll be testing it next Sunday.
My questions:
are there any daemons to restart?
I keep a copy on original
/etc/init/control-alt-del.conf
in /etc/init, is it safe?
I mean won't the shutdown part of exec be fired?more official way to disable Ctrl+Alt+Del?
edit:
tested on vmware player 6.0.3 (for what it is worth, this is not a virtualization issue)
- editing file, no exec line, no restart, user logged on gui, send Ctrl+Alt+Del : shutdown prompt
- after restart, no exec line, user logged on gui, send Ctrl+Alt+Del : shutdown prompt
- after restart, exec /bin/true, user logged on gui, send Ctrl+Alt+Del : shutdown prompt
- after restart, exec /bin/true, no user logged on gui, send Ctrl+Alt+Del : no shutdown prompt
-
Admin about 6 yearsHere is an init independent description of how the Linux kernel deals with Ctrl + Alt + Del: unix.stackexchange.com/questions/42573/…
-
Арсений Черенков almost 10 yearsthose are production system, I have no way to test it before a scheduled stop next sunday, when those will be reboted anyway.
-
Anthon almost 10 years@Archemar After the reboot things should be ok.
-
Gilles 'SO- stop being evil' almost 10 yearsWhy wouldn't one set the Ctrl+Alt+Del handling in
/etc/inittab
even today? RHEL 6.2 uses SysVinit. -
Timothy Martin almost 10 years@Gilles The /etc/inittab file is deprecated, and is now used only for setting up the default runlevel via the initdefault line. Other configuration is done via upstart jobs in the /etc/init directory. Copied from the Redhat Deployment site
-
Stephen Gornick almost 4 yearsAnswer "borrowed" from this response to a nearly identical question: askubuntu.com/questions/763887/…