How do we disable ctrl-alt-del on Ubuntu 16.04?
In previous versions of Ubuntu server, to disable CtrlAltDel (reboot), we would edit the /etc/init/control-alt-delete.conf file and change the script to display a message telling that this function won't work any more.
What would be the new way to disable CtrlAltDel, now?
1 Answer
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.systemctl mask ctrl-alt-del.target
systemctl daemon-reloadThis 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:
SIGINTUpon receiving this signal the systemd system manager will start the
ctrl-alt-del.targetunit. This is mostly equivalent tosystemctl 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.