How do I log a user completely out of AIX from inside a script?

When the user logs in, the .profile runs a shell script that displays a menu.  If the Quit option is selected, I want the user to be logged completely out of AIX.  The following, which I'm now using, exits to the O/S.  The user must then manually type "exit" to log completely out of AIX.

[Qq ]  ) exit 0;;    # user types "Q" or "q" from the displayed menu
* ) ;;

esac
done
exit 0

I don't want the user to have access to an OS command line prompt at all.  Anyone know how I can log the user out from inside the script?

Thanks!
monkeybiz12345Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

omarfaridCommented:
If this run in .profile, make sure to change the ^C using stty command since user might break the script with ^C (Control-C). Similarly for ^Z. Please see stty man page to see how to do it.

In the *) case, you just put the exit command:

*)
exit
;;
esac
0
TintinCommented:
In the .profile where the script is invoked, prefix it with exec, eg:

exec /path/to/menu-script

exec overlays the current process (shell) with the command specified.  
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cloud5Commented:
If you wish *any* exit of the script to log out of AIX, change your script execution from this form:

  /path/script

to

  exec /path/script

To prevent the user from being able to press Ctrl-C, Ctrl-\, Ctrl-U, or Ctrl-Z, do this prior to the "exec" (best location is at the very top of the user's .profile or, even better, if *ALL* users should be subject to this, near the top of /etc/profile):

    trap "" 2 3 15 18

(that's two quotation marks)

This tells the shell simply to ignore those four signals, *even if they've been changed to different key sequences elsewhere*.

So, the full sequence is:

    trap "" 2 3 15 18

    ...

    exec /path/script
0
monkeybiz12345Author Commented:
Thanks!  Exactly the info I needed.  Split points because both of you provided great answers to what I can now see was a not quite clear enough question.  
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.