Here's the issue. I need to create a login agreement where the user must accept in order to log in to the system. If they select cancel to the agreement, they need to be immediately logged off. I am using a zenity question window for this purpose. I have the zenity window info in the /etc/gdm/PostLogin/Default file, which also creates a file in temp if they select cancel. In the /etc/gdm/PreSession/Default file, I have an if statement that looks for that file in temp, and if it sees it, issues a command to log the user account off immediately. Problem is, the command to kill the login session will not work. I have tried kill -9 with variables to get the PID and stop it. I have tried executing an exit 1 and an exit 9, as well as a return 0. I have also tried a pkill -u $LOGNAME. Nothing works. However, I can run other commands without issue. Things like reboot, touch, echo > filename all work. It's like the user session isn't started yet. Here's what I have in the files:


# Show User Agreement notification box with Cancel or Accept buttons.
zenity --question --title=ATTENTION --text="This will be the text area for the User Agreement.\n\nSelect Cancel to Logoff. Select Accept if you accept the agreement."

if ( test 1 -eq $? ); then
touch /tmp/logon.cancel


if [ -e "/tmp/logon.cancel" ]; then
rm -rf "/tmp/logon.cancel"
exit 1


Anyone have any ideas on why this won't work? Everthing I can find is older than RHEL6, and doesn't work. Any help is MUCH appreciated.