4

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
1

4 Answers 4

1

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.

4
  • those are production system, I have no way to test it before a scheduled stop next sunday, when those will be reboted anyway. Commented Sep 5, 2014 at 9:37
  • @Archemar After the reboot things should be ok. Commented Sep 5, 2014 at 9:39
  • Why wouldn't one set the Ctrl+Alt+Del handling in /etc/inittab even today? RHEL 6.2 uses SysVinit. Commented Sep 5, 2014 at 22:52
  • 1
    @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 Commented Sep 5, 2014 at 23:41
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.

0

In the systemd world, CtrlAltDel is handled by ctrl-alt-del.target:

ctrl-alt-del.target
   systemd starts this target whenever Control+Alt+Del is pressed on
   the console. Usually, this should be aliased (symlinked) to
   reboot.target.

To disable this target, do:

systemctl mask ctrl-alt-del.target
systemctl daemon-reload

This does not completely disable CtrlAltDel. Systemd has a feature where pressing that key combination more than 7 times in 2 seconds triggers an immediate reboot. I'm not sure how to disable it, but I find it useful.

I don't think it can be disabled. From the systemd manpage:

SIGINT

Upon receiving this signal the systemd system manager will start the ctrl-alt-del.target unit. This is mostly equivalent to systemctl start ctl-alt-del.target. If this signal is received more than 7 times per 2s, an immediate reboot is triggered. Note that pressing Ctrl-Alt-Del on the console will trigger this signal. Hence, if a reboot is hanging, pressing Ctrl-Alt-Del more than 7 times in 2s is a relatively safe way to trigger an immediate reboot.

systemd user managers treat this signal the same way as SIGTERM.

1
0

As of SystemD 244, there is a new feature to specifies the behavior of the ctrl-alt-del burst action (more than 7 times per 2s). From the source:

"A new setting CtrlAltDelBurstAction= has been added to /etc/systemd/system.conf which may be used to configure the precise behaviour if the user on the console presses Ctrl-Alt-Del more often than 7 times in 2s. Previously this would unconditionally result in an expedited, immediate reboot. With this new setting the precise operation may be configured in more detail, and also turned off entirely."

The possible options are: "reboot-force", "poweroff-force", "reboot-immediate", "poweroff-immediate" or disabled with "none"

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.