How do I create a popup banner before login with Lightdm?

Solution 1:

The configuration file /etc/lightdm/lightdm.conf defines the available sessions. The sessions themselves are defined in /usr/share/xsessions. It should be not a problem to modify the default /usr/share/xsessions/ubuntu.desktop to wrap the gnome-session command around in a script that first displays the zenity dialog, and then either exits with a nonzero status or launches the gnome-session command.

Specifically:

  1. Create a file called /usr/bin/mysess.sh which contains, for example, the following:

    #!/bin/bash
    
    if  /usr/bin/zenity --question --text="`cat /etc/issue`" --no-wrap ; then gnome-session --session=ubuntu ; else exit 1 ; fi
    

    To edit this file, use

    gksu gedit /usr/bin/mysess.sh
    

    Also, make it executable

    sudo chmod a+x /usr/bin/mysess.sh
    
  2. Modify the file /usr/share/xsessions/ubuntu.desktop as follows:

    [Desktop Entry]
    Name=Ubuntu
    Comment=This session logs you into Ubuntu
    Exec=/usr/bin/mysess.sh
    TryExec=unity
    Icon=
    Type=Application
    X-Ubuntu-Gettext-Domain=gnome-session-3.0
    

Now, if anyone tries to log on, the person has to click "Yes" in order to log in; otherwise, it will return to the login screen.