How do I script a graphical banner in CentOS 6?

Support for security such as Firewalls and securing linux
Post Reply
dobsonunit
Posts: 3
Joined: 2015/01/09 15:34:36

How do I script a graphical banner in CentOS 6?

Post by dobsonunit » 2015/01/09 20:48:19

Hi,

Having had to script the process via kickstart %post about installing a banner on CentOS 6, I thought I would share my successful result.

This will disable the list of users on the graphical console and place a text banner on the user ID prompt screen.

Code: Select all

!#/bin/bash
# Set the banner on the GUI console screen and disable the automatic showing of users on console via GConf2 package tool "gconftool-2"

if ! ] -3 /usr/bin/gconftool-2 ]; then
   echo "Installing GConf2 tool."
   yum -y install GConf2
fi
if [ -e /usr/bin/gconftool-2 ]; then
# Disable display of users on GUI console screen
   /usr/bin/gconftool-2 --direct --config-source=`gconftool-2 --get-default-source` --set /apps/gdm/simple-greeter/disable_user_list --type bool true

# To set warning banner in GUI mode
   /usr/bin/gconftool-2 --direct --config-source=`gconftool-2  -get-default-source` --set /apps/gdm/simple-greeter/banner_message_enable --type bool true

# To set contents of banner message text to appear on console
   /usr/bin/gconftool-2 --direct --config-source=`gconftool-2 --get-default-source` --set /apps/gdm/simple-greeter/banner_message_text --type string "$(cat /etc/issue)"
fi
One may also enclose the desired text inside double-quote marks instead of using the contents of the /etc/issue file (as we do).

Suggestions and improvements always welcome.

Cheers,
megan

Post Reply