Thursday, January 11, 2018

How to Disable Ctrl-Alt-Delete in Ubuntu ?

Having a physical access to the keyboard can simply use the Ctrl+Alt+Delete key combination to reboot the server without having to logged on, But we can prevent the use of this key combination on a production server for an accidental reboots.
To disable the reboot action taken by pressing the Ctrl+Alt+Delete key combination,
Comment out the following line in the file /etc/init/control-alt-delete.conf
$ sudo vi /etc/init/control-alt-delete.conf
Or
$sudo gedit /etc/init/control-alt-delete.conf
Find line that read as follows:
exec shutdown -r now “Control-Alt-Delete pressed”
delete configuration line or comment out line by prefixing # symbol
#exec shutdown -r now "Control-Alt-Delete pressed"
Save and close the file.
But In 16.04
In the systemd world, Ctrl+Alt+Delete 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.

Disable Ctrl+Alt+Delete using following command

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

No comments:

Post a Comment