Disable reboot on control-alt-delete for RedHat/CentOS 5/6/7 As root, run:

#!/bin/sh
if cat /etc/redhat-release | grep -q 'release 5'; then
  cp /etc/inittab /etc/inittab.install
  sed -i 's/ca::ctrlaltdel/#ca::ctrlaltdel/' /etc/inittab
  init q
elif cat /etc/redhat-release | grep -q 'release 6'; then
  cat &lt;&lt; EOF &gt; /etc/init/control-alt-delete.conf
exec false
EOF
elif cat /etc/redhat-release | grep -q 'release 7'; then
  systemctl mask ctrl-alt-del.target
  systemctl daemon-reload
else
  cat /etc/redhat-release 2&gt;&amp;1 | mailx -s "ctrl-alt-delete disable failure" some.user@company.com
fi
That's a four calls to cat /etc/redhat-release.  A case statement could help reduce the clutter:

case "`cat /etc/redhat-release`" in
  *"release 5."*)
    cp /etc/inittab /etc/inittab.install
    sed -i 's/ca::ctrlaltdel/#ca::ctrlaltdel/' /etc/inittab
    init q
    ;;
  *"release 6."*)
    echo 'exec false' &gt; /etc/init/control-alt-delete.conf
    ;;
  *"release 7."*)
    systemctl mask ctrl-alt-del.target
    systemctl daemon-release
    ;;
  *)
    cat /etc/redhat-release 2&gt;&amp;1 | mailx -s "ctrl-alt-delete disable failure" some.user@example.com
    ;;
esac