Shell Scripting Example 7 – Shell Script to Disable Control + Alt +Delete option in Multiple Server

Posted: April 22, 2015 in Disbable Ctl+Alt+Del in * Server, Shell Script

Shell script to disable Control + Alt +Delete option.

We are using most of our Linux server in RHEL 5 & RHEL 6 Flavor.This very important because if it is VM Server or physical Server by mistakable if use the key server will reboot . this dangerous situation in production or live server environment.

 

First we have find RHEL 5 or 6server.

If it is RHEL 5 means made changes in /etc/inittab.

Else

If it is RHEL 6 means made changes in /etc/init/control-alt-delete.conf

 

36

 

Advertisements
Comments
  1. evolart says:

    Used this as a base for a script that we are kicking off for all RHEL 5-7 VMs. This also disables ctrl-alt-delete in RHEL 7 VMs that are running a GUI (not many in our environment).

    #!/bin/bash
    rls=`cat /etc/redhat-release | awk ‘{print $7}’`

    if [[ $rls = *5.* ]] ; then
    sed -i ‘s/^ca::ctrl/#ca::ctrl/g’ /etc/inittab
    fi

    if [[ $rls = *6.* ]] ; then
    sed -i ‘s/^exec/#exec/g’ /etc/init/control-alt-delete.conf
    fi

    if [[ $rls = *7.* ]] ; then
    systemctl mask ctrl-alt-del.target
    systemctl daemon-reload

    if [[ -d /etc/dconf ]] ; then
    touch /etc/dconf/db/local.d/00-disable-CAD
    echo “[org/gnome/settings-daemon/plugins/media-keys]
    logout=”” > /etc/dconf/db/local.d/00-disable-CAD
    dconf update
    fi
    fi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s