How to disable ctrl-alt-del and /etc/init/control-alt-del.conf in Linux?

5,751

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.

Share:
5,751
Арсений Черенков
Author by

Арсений Черенков

When everything else has failed, read the manual, log a call.

Updated on September 18, 2022

Comments

  • Арсений Черенков
    Арсений Черенков almost 2 years

    My OS is RHEL 6.2

    I disable Ctrl+Alt+Del by changing in /etc/init/control-alt-del.conf the line

    exec /sbin/shutdown -r now "Control-alt-del pressed"
    

    by

    exec /bin/true
    

    I'll be testing it next Sunday.

    My questions:

    1. are there any daemons to restart?

    2. 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?

    3. 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)

    1. editing file, no exec line, no restart, user logged on gui, send Ctrl+Alt+Del : shutdown prompt
    2. after restart, no exec line, user logged on gui, send Ctrl+Alt+Del : shutdown prompt
    3. after restart, exec /bin/true, user logged on gui, send Ctrl+Alt+Del : shutdown prompt
    4. after restart, exec /bin/true, no user logged on gui, send Ctrl+Alt+Del : no shutdown prompt
  • Арсений Черенков
    Арсений Черенков almost 10 years
    those are production system, I have no way to test it before a scheduled stop next sunday, when those will be reboted anyway.
  • Anthon
    Anthon almost 10 years
    @Archemar After the reboot things should be ok.
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' almost 10 years
    Why wouldn't one set the Ctrl+Alt+Del handling in /etc/inittab even today? RHEL 6.2 uses SysVinit.
  • Timothy Martin
    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
    Stephen Gornick almost 4 years
    Answer "borrowed" from this response to a nearly identical question: askubuntu.com/questions/763887/…