11

In some circumstances it would be valuable for me to be presented with a short, text notification prior to logging in, so that I have the option to decide not to log in after seeing the message.

Is there a way to display a notification message on the graphical login screen?

9
  • Do you want the message to appear before you log in? Or immediately once you've entered your username and password? Commented Feb 6, 2013 at 17:19
  • 1
    What kind of notifications? I mean, before you're logged in, no applications like IM client are running yet. I can only think of battery stateus (mobile PC) and system-level Network Manager profiles connecting. And in what context is this? Pure user or developing an application?
    – gertvdijk
    Commented Feb 6, 2013 at 17:22
  • I'm interested in a general answer; I have no specific requirements for message timing or tools used to generate the message.
    – ændrük
    Commented Feb 6, 2013 at 17:34
  • you mean something like , login screen then your message. No need of any sign-in ?
    – Raja G
    Commented Feb 6, 2013 at 18:02
  • @snow "prior to logging in" <--
    – gertvdijk
    Commented Feb 6, 2013 at 18:09

3 Answers 3

3

I realize this is a late response (like, years late) but I thought I would go ahead and put something here for anyone else having the same issues. I see this issue all the time. This is just one way to do it that is easy to script and deploy. Keep in mind this is an inelegant solution that is similar to this one: How do I create a popup banner before login with Lightdm?

  1. Create a file and name it anything you want such as: anythingYouWant
  2. Put the following in that file (replacing the banner text of course):

    bannerText="This is my banner and you will love it.  Worship it!"
    
    zenity --question --title="Pirate Ninja Banner" \
    --text=$bannerText" --no-wrap --width=800 --height=200
    
    until [[ $? = '0' ]]: do
       zenity --question --title="Pirate Ninja Banner" \
       --text=$bannerText" --no-wrap --width=800 --height=200
    done
    
  3. Adjust width and height to whatever you need.

    3a. The idea here is when the login message displays the user can't proceed until they agree to the terms, thus it loops until "yes" is selected.

NOTE (because I didn't know this before): zenity --list can return true yes false no (Boolean values), zenity --question returns exit 0,1

  1. Make your file executable:

    sudo chmod +x anythingYouWant
    
  2. Put it somewhere -- I just stuck it in /usr/bin

    sudo mv anythingYouWant /usr/bin
    

-----------LIGHTDM-----------------------

  1. If you are using lightdm then you'll need to modify your lightdm.conf file. When I went to do this the first time lightdm.conf wasn't there T_T. So, if it isn't, that's okay, go get you a copy by doing this:

    sudo cp /usr/share/doc/lightdm/lightdm.conf /etc/lightdm/
    
  2. If that didn't work then it could be that the file in /usr/share/doc/lightdm/ is zipped up so do:

    sudo gzip -d /usr/share/doc/lightdm/lightdm.conf.gz
    

    7a. Then move the file to /etc/lightdm/

  3. Open up lightdm.conf (that should now be in /etc/lightdm/) and add the following beneath the section that says [SeatDefaults], like this:

    [SeatDefaults]
    greeter-setup-script=/path/to/your/loginMessage
    

    8a. Where /path/to/your/loginMessage is wherever you put the executable you created earlier. I put mine in /usr/bin so mine looks like:

    [SeatDefaults]
    greeter-setup-script=/usr/bin/loginmessage
    

    8b. Save the file

  4. That should about do it for lightdm. You could also just create your own lightdm.conf file and put the above into it.

    9a. Reboot.

-----------GDM-------------------

  1. I tested this popup "loop" on CenOS 7 and Ubuntu 14.04 with GDM as well. Thing is, lightdm.conf doesn't really help in the case of GDM now does it?

  2. Well, there is a work around that works for me (for now).

  3. Open the file /etc/gdm/Init/Default

    sudo vim /etc/gdm/Init/Default
    
  4. Go to the bottom of the file.

  5. Right above exit 0 put:

    exec /path/to/your/message
    

    14a. Where /path/to/your/message is the path to your nifty login message. When all done it should look something like this:

    fi
    exec /usr/bin/loginmessage
    exit 0
    

    14b. The "fi" and the "exit 0" are already there, you just put in the "exec /path/to/your/message part of it.

    14c. Save and reboot.

  6. All the rebooting probably isn't necessary. I test this stuff in vm's so its easier to just bounce the machine.

  7. If there are better ways to do this I'm all ears/eyes. I know that gconf works swell in CentOS 6.x. I know that dconf kind of works in CentOS 7 but I wasn't getting what I wanted. None of the gconf stuff has worked for me in Ubuntu, even after installing GDM and reconfiguring <- could just be me though.

2

It may not be possible to display the message on the login screen directly. But you can send a message prior to logging in. Add to your /etc/lightdm/lightdm.conf:

greeter-setup-script=xmessage -button ok -default ok -center "Hello world"

Be cautious as wrong option in this file can break your boot procedure.
Mouse will be unavailable on this stage, but you will be able to close the message with Enter. xmessage can read the message text from the file or can have custom timeout. Check its manpage for additional options.
You may check https://wiki.ubuntu.com/LightDM for additional information about lightdm.conf and greeter customization.

-2

You can modify the login banner to show the warning you want to show. For more details, you can have a look at the below mentioned link:-

http://www.howtogeek.com/howto/ubuntu/change-ssh-welcome-banner-on-ubuntu/

1
  • 1
    I think the OP meant the graphical login screen.
    – zwets
    Commented Mar 14, 2013 at 9:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .