How to Disable CTRL-ALT-DEL shutdown key on Linux server

Posted by Planet Malaysia on September 4, 2008

advertisement

[Ctrl]-[Alt]-[Delete] is a shortcut key to shutdown/reboot the server without having to log on but sometimes it will be a problem by accidently pressing the [Ctrl]-[Alt]-[Delete] key in the production Linux server console. In order to prevent the use of [Ctrl]-[Alt]-[Delete] key combination on a production server, we MUST disable it.

Basically it is configured using /etc/inittab file. This is the main configuration file of /sbin/init, which is executed by the kernel on startup. It describes what scripts are used for the different run-levels. Edit /etc/inittab file and comment (or remove it) ctrlaltdel entry.

Edit configuration file:
# vi /etc/inittab

Search for line:
ca::ctrlaltdel:/sbin/shutdown -r -t 4 now

Remove the line or comment out the above line by putting a hash mark (#) in front of it:
#ca::ctrlaltdel:/sbin/shutdown -r -t 4 now

Save the file and exit to shell prompt:
:wq!

Enter init q to take immediate effect without reboot
# init q

Alternatively, you may just want to allow certain non-root users the right to shutdown the system from the console using [Ctrl]-[Alt]-[Delete]. You can restrict this privilege to certain users, by taking the following steps:

Add the -a option to the /etc/inittab line shown below:
ca::ctrlaltdel:/sbin/shutdown -a -r -t 4 now

#The -a flag tells shutdown to look for the /etc/shutdown.allow file.

Create a file named shutdown.allow in /etc
# vi /etc/shutdown.allow

The shutdown.allow file list the usernames (one per line) of any users who are allowed to shutdown the system using [Ctrl]-[Alt]-[Delete] combination key. Insert usernames as below and save it.
admin
superuser
kenny
root

Anyone of them, ‘admin’, ’superuser’ ‘root’ & ‘kenny’ are allowed to shutdown the system from the console using [Ctrl]-[Alt]-[Delete] combination key.

Enjoy! How to Disable CTRL-ALT-DEL shutdown key on Linux server.

Possibly Related Posts:


Comments

Leave a Reply




Planet Malaysia

  • Follow us on Twitter


  • web www.planetmy.com