Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shell restriction

Status
Not open for further replies.
Oct 11, 2002
57
AD
How can I restrict a user to just a simple menu (already programmed in dialog) so that he will not be able to perform Ctrl+C and when he exits the menu he will be logged out automaticaly ?

TIA
Eduardo.

EDC
--------------------------------------
This is Unix-Land. In quiet nights, you can hear the Windows machines
reboot.
 
Hello,

there are two common approaches:

1) Make the user's shell a restricted shell; you may define which commands a user will be able to use.
I never tried it myself, but it should work.
For details have a look at man rksh for example.

2) Call your menue program in the user's .profile (or whatever it is called in your favourite shell) and put an exit in the line below.
Once upon a time I successfully implemented this in another flavour of Unix. And I recommend it.
If you do it this way, you will have to take care that the user will never ever get a Unix prompt, neither by accident, nor by deliberately pressing a key like Ctrl+C.
You may make the program ignore interupts by trap command. I don't remember the exact syntax just now, but you will find it in your shell man page.
And for further security, call the menue by exec, i.e. not like this:
/path/to/menue
but like this:
exec /path/to/menue
This will replace the login shell by the menue program, and there will be no return to the login shell, even if the menue program crashes.

hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top