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:
[org/gnome/login-screen]
banner-message-enable=true
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

References

[1] Linux: Display a login banner gfor Gnome (GDM) manager
http://www.cyberciti.biz/tips/howto-unix-linux-change-gnome-login-banner.html
[2] RHEL6: Login Banners | SecureOS
http://secureos.wordpress.com/2011/07/21/rhel6-login-banner/
Wikipedia - GConf
http://en.wikipedia.org/wiki/GConf
[3] Chapter 3. GSettings and dconf
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Desktop_Migration_and_Administration_Guide/gsettings-dconf.html
[4] GConf configuration system
https://projects.gnome.org/gconf/
[5] Redhat - Introduction GConfiguration Overview
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Desktop_Deployment_Guide/ch-intro-gconf-overview.html
[6] Ask Fedora - How do I disable user list in gdm?
https://ask.fedoraproject.org/en/question/9875/how-do-i-disable-user-list-in-gdm/

No comments:

Post a Comment