Login banners are simply a requirement for enterprise and government computer systems. In RHEL 6, modifying the gdm login theme to display the banner is rather difficult, since they removed the GUI to modify the login theme. However, there is a solution:
One way to present the login banner is to create a pop-up dialog box with the login banner text inside of it. This dialog will appear as soon as the X-Server loads and before the user is prompted to enter in a username and password. Thus, it meets the requirement of the user seeing the dialog before login.
How to do it:
For this, we will make use of zenity. Zenity is a console command that displays popup messages. However, before we display the popup, we need to create a file with the login banner text.
- Create a text file to hold the login banner text. To demonstrate this, I have created a text file called “
login_banner.txt” with some sample login banner text:
- Once you have created your login banner text file, you should move it to some global location where anyone can read the file. I would suggest
- The next step is to tell GDM to show the banner before a user logs in. To do this, you will need to (as
root) modify the
/etc/gdm/Init/Defaultfile. Towards the bottom of the file (before the
exit 0), paste in the command:
## Display a login banner: zenity --text-info --filename=/PATH/TO/LOGIN_BANNER_FILE.TXT --width=NUM --height=NUM --title="LOGIN WARNING"
For example, here is what my
/etc/gdm/Init/Defaultfile looks like:
- Save the file, and you are done!
If done properly, you should see something like this when you try to log in:
As a sidenote, if you “switch user”, the banner is also properly displayed. There are several other options you can use for the window’s size, buttons, etc. You can just play around with the zenity command in the Init/Default file to find the options that best suits your needs.
This should really be documented on Red Hat’s site, since RHEL is an industry standard OS, and login banners *are* an industry requirement.