Disable ctrl-c,ctrl-d,ctrl-d in ksh script

I wrote a ksh script for Helpdesk. I need to know how to disable ctrl-c,ctrl-z,ctrl-d..... so that helpdesk would not be able to get to system prompt :confused:

You're leaving a shell underneath your script and then you're worrying about users escaping to it. Either exec the the script or make it the users' login shell. Then there is no underlying shell to escape to.

I think Perderabo has already given you the best solution possible (make the script the login shell). You could also "trap" some signals (signal 1 is <CTRL>-<C>, for instance, "man ksh" and search for "trap"), but Perderabos way is still better and more general.

bakunin

Sorry! I renamed the srcipt dumm.ksh as .profile, it is still able to enter ctrl-c to be at system prompt. Please help

Rename it back. Make sure it starts with
#! /usr/bin/ksh
or whatever your path to ksh is. Edit /etc/passwd to make the script the login shell. If that doesn't work, change .profile to one line:
exec /path/to/script
The second idea leaves a window. Until the shell runs that exec, a cntl-c is possible.

The reason why you don't get the desired result is you aren't carrying out Perderabos advice: "~/.profile" is a script which is run at some point during shell startup. This means that your Helpdesk user has still "/bin/sh" or something such configured as login shell in /etc/passwd. Having a shell execute a script at startup is not the same as having this scipt as shell.

Instead of renaming your script to ".profile" you should change the entry in /etc/passwd for the users login shell from (presumably) "/bin/ksh" to "/this/users/home/script.sh", and rename the script back to "script.sh".

Don't forget to add this to the list of allowed login programs in /etc/security/login.cfg if you are on an AIX box and probably to something analogous if you are on another system.

bakunin

Thanks for of your help.... Works like a charm