Friday, 5 September 2014

Welcome Banners in Linux

Seriously, there are more ways to create a Welcome Banner in Linux than there are to skin a cat.

As a matter of fact, only one of several ways will work on your system. It depends on what kind of system you have.

In my case I wished to automate the process, by referring to a file instead of having to type a new logon banner message every time.

Redhat Enterprise Linux 5

Change your custom.conf1, presumably it can be found somewhere in /etc/gdm/.

Redhat Enterprise Linux 6/Ubuntu 12

The new way2 4, using gconftool-2 to set appropriate key-value pairs.
gconftool-2 --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults --type bool -s /apps/gdm/simple-greeter/banner_message_enable true
gconftool-2 --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults --type string -s /apps/gdm/simple-greeter/banner_message_text "Your-Login-Banner"
gconftool-2 --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults --type string -s /apps/gdm/simple-greeter/banner_message_text "$(cat /opt/tools/info/message_of_the_day)"
gconftool-2 --config-source=xml:readonly:/etc/gconf/gconf.xml.defaults --get /apps/gdm/simple-greeter/banner_message_text

To effect this globally, we'll need to change it in a gconf database. The database used are dependent on who is logged on, but we don't want that.

The file /etc/gconf/2/path will show in which paths the database is consulted. The paths are in order of precedence. This means if an entry is found in one of the first databases, the entry is ignored in one of the latter databases.

By default there is a Mandatory Source, a User Source and a Defaults Source5. They are:
  • xml:readonly:/etc/gconf/gconf.xml.mandatory
  • xml:readwrite:$(HOME)/.gconf
  • xml:readonly:/etc/gconf/gconf.xml.defaults

If you wish you can set the logon message manually, using the gconf-editor tool. If you start it up as root, you will be able to select under "File" different profiles, namely the "Defaults" one and the "Mandatory" one.

Redhat Enterprise Linux 7

The new new way! People are migrating from GConf (gconftool-2, gconf-editor) over to GSettings3 and dconf (dconf-tool, dconf-editor).

Fedora 20

The workaround for Fedora, because the new new way doesn't work6.

Create file /etc/dconf/db/gdm.d/01-mysettings:
banner-message-text='hostname: wiggins\n“How often have I said to you that when you have eliminated the impossible,\n whatever remains, however improbable, must be the truth?”\n\n- Sherlock Holmes, The Sign of the Four (1890)'
Don't forget to run, to recreate the database with the new settings:
rm /etc/dconf/db/gdm
dconf update


[1] Linux: Display a login banner gfor Gnome (GDM) manager
[2] RHEL6: Login Banners | SecureOS
Wikipedia - GConf
[3] Chapter 3. GSettings and dconf
[4] GConf configuration system
[5] Redhat - Introduction GConfiguration Overview
[6] Ask Fedora - How do I disable user list in gdm?

No comments:

Post a Comment