Zenity Login Dialog
-
So I have kind of a unique need. Due to circumstances beyond my control, we need a login banner displayed on our RHEL 6 systems. Usually
/etc/issue
and the message-banner on the login screen can take care of it. However we also need a dialog box to make the user accept the terms for the system. RHEL 5 had Gdialog but it's gone. So I used Zenity. We can edit the Default script in `/etc/gdm/PreSession/' and add:zenity --question --text="This is a super secure system. You give up your children and family to use it, yada yada. Do you accept?" userResponse=$? if [ $userResponse == "1" ]; then exit 1 fi
This takes care of the local logins, however X2Go doesn't use the GDM login so that doesn't help for remote logins. For X2Go what I figured out was if I edit the
/usr/bin/x2goruncommand
and change:if [ "$cmd" == "GNOME" ] || [ "$cmd" == "gnome-session" ]; then cmd="/usr/bin/gnome-session"
to
if [ "$cmd" == "GNOME" ] || [ "$cmd" == "gnome-session" ]; then cmd="my-custom-script"
which calls this script:
#!/bin/bash zenity --question --text="This is a super secure system. You give up your children and family to use it, yada yada. Do you accept?" userResponse=$? if [ $userResponse == "1" ]; then exit 1 fi /usr/bin/gnome-session
Then I get the popup through X2Go and if I hit "Cancel", it cancels the session, and if I hit "OK" it logs me in.
This is using RHEL 6 systems. With Ubuntu the x2goruncommand does some crazy checking to see what version of Ubuntu you're running. If you're running Ubuntu, you'll need more debugging.