≡ Menu

login banner

Linux: Display a login banner for Gnome (GDM) Desktop

You can easily use /etc/issue file to display a pre-login message / login warning banner for text based session. You can also force OpenSSH (SSHD) to display a login message or banner. But how do you force GDM to display a login banner for all local and remote users?

GDM customization

GDM is a replacement for XDM, the X Display Manager. GDM runs and manages the X servers for both local and remote logins (using XDMCP). You can easily configure GDM to display message. You need to open gdm custom configuration file:

[a] RHEL / CentOS / Fedora Linux : Open /etc/gdm/custom.conf file.
[b] Debian / Ubuntu Linux : Open /etc/gdm/gdm.conf-custom file.

This file is the appropriate place for specifying your customizations to the GDM configuration. If you run gdmsetup, it will automatically edit this file for you and will cause the daemon and any running GDM GUI programs to automatically update with the new configuration. Not all configuration options are supported by gdmsetup, so to modify some values it may be necessary to modify this file directly by hand.

Display a login banner for Gnome / GDM under Linux

Open /etc/gdm/custom.conf file:
# vi /etc/gdm/custom.conf
Find out [greeter] section and append following text:
DefaultWelcome=false
Welcome=Message for local users
RemoteWelcome=Message for remote login users

Save and close the file.

A note about RHEL / CentOS / Fedora user

Apart from above configuration you also need to add following line inder the [daemon] section:
Greeter=/usr/libexec/gdmlogin

Using GUI tool gdmsetup

gdmsetup is a graphical tool for easily changing the most commonly used options including greeting messages. As I mentioned earlier gdmsetup does not support changing of all onfiguration variables, so it may be necessary to edit the files by hand for some configurations and security issues. Open X terminal and enter the command:
$ sudo gdmsetup
How do I display a login warning banner for GDM under Linux / UNIX with gdmsetup?
(click to enlarge)

Select Local tab > Welcome Messages > Custom > Enter your custom message > Click on Close button to save the changes.

Pre login banner is use for sending a warning message before authentication may be relevant for getting legal protection or just give out information to users. The contents of the specified file are sent to the remote user before authentication is allowed. This option is only available for protocol version 2. By default, no banner is displayed (if you are using latest version of Linux/UNIX then you do not have to worry about version issue).

Procedure to change OpenSSH pre login banner

1) By default sshd server turns off this feature.

2) Login as the root user; create your login banner file:

# vi /etc/ssh/sshd-banner

Append text:
Welcome to nixCraft Remote Login!

3) Open sshd configuration file /etc/sshd/sshd_config using a text editor:

# vi /etc/sshd/sshd_config

4) Add/edit the following line:

Banner /etc/ssh/sshd-banner

5) Save file and restart the sshd server:

# /etc/init.d/sshd restart

6) Test your new banner (from Linux or UNIX workstation or use any other ssh client):

$ ssh vivek@rh3es.nixcraft.org

Output:
Welcome to nixCraft Labs!
vivek@ rh3es.nixcraft.org's password:

Please note that this feature may not work with third party ssh client such as Putty.