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


 
Thread Tools Search this Thread
Operating Systems AIX Disable ctrl-c,ctrl-d,ctrl-d in ksh script
# 1  
Old 06-28-2005
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 Smilie
# 2  
Old 06-29-2005
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.
# 3  
Old 06-29-2005
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
# 4  
Old 06-29-2005
Sorry! I renamed the srcipt dumm.ksh as .profile, it is still able to enter ctrl-c to be at system prompt. Please help
# 5  
Old 06-29-2005
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.
# 6  
Old 06-29-2005
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
# 7  
Old 06-29-2005
Thanks for of your help.... Works like a charm
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Automation of keyboard inputs..like Ctrl+d and Ctrl+a

Hi..! I'm stuck with my automation of starting a process and keeping it running even after the current ssh session has exited.. So i'm trying to use command 'screen'. which is doing exactly what i wanted, But the problem is automation of the same. i will have to press Ctrl+a and Ctrl+d for... (2 Replies)
Discussion started by: chandana hs
2 Replies

2. UNIX for Dummies Questions & Answers

Ctrl-V + Ctrl-J for newline character does not work inside vi editor

Hi friends, I am trying to add a newline char ('\n') between the query and the commit statement in the following shell script. #! /bin/sh echo "select * from tab; commit;" > data.sql I have tried typing in "Ctrl-V + Ctrl-J" combination which has inserted ^@ (NUL) character but the commit... (1 Reply)
Discussion started by: royalibrahim
1 Replies

3. Shell Programming and Scripting

How to handle CTRL+Z or CTRL+C in shells script?

Hi, while executing shell script, in the middle of the process, if we kill the shell script( ctrl+z or ctrl+c), script will be killed and the files which using for the script will be in the folder. How to handle those scenarios. Is there any possibilities, if user breaks the script, I need to... (3 Replies)
Discussion started by: ckchelladurai
3 Replies

4. Solaris

Disable Ctrl+Backspce

Hello to all, I have one sun solaris workstation. Interrupt is Alt+Backspace, but if I press Ctrl+Backspace, I totaly log out and all programs are closed. This is not what I want and wonder if there is some way to disable this feature. Thanks (2 Replies)
Discussion started by: Mick
2 Replies

5. Shell Programming and Scripting

ctrl-c in script

how to send ctrl-c signal in scripts ??? i am executing top command in .exp script top command gives cpu running activities on your machine eg # top top - 18:41:01 up 8:38, 5 users, load average: 0.03, 0.16, 0.16 Tasks: 172 total, 1 running, 170 sleeping, 0 stopped, 1 zombie... (3 Replies)
Discussion started by: alexzander18
3 Replies

6. Shell Programming and Scripting

KSH to execute stored procs/ctrl files

I am needing to call sqlplus and sqlldr in the same korn shell script. Below are the steps that I need to accomplish. I am new to Oracle shell scripting so an example would be great. CBOB_LOAD.KSH - script name Calls Oracle stored procedure sp_CBOB_CLEAR_LN_STAGING (SERVER: TESTSVR100) Calls... (0 Replies)
Discussion started by: acewilli
0 Replies

7. Shell Programming and Scripting

Ctrl-C or Ctrl-Z causing exit the session

H! I have written script where it need to invoke the perl script in background, then write the pid in temp file then bring back the job to foreground. whenever the Ctrl-C or Ctrl-Z is pressed in the script has to exit and prompt should be dispalyed. but this script causing exit from shell session... (2 Replies)
Discussion started by: jramesh1
2 Replies

8. UNIX for Advanced & Expert Users

Disable and Enable Backspace or Ctrl^H in vi

Could anybody tell me how I can disable or enable the backspace key in vi editor. I would like to feel the essence of the commands of vi editor but as I have the latest version and it is supporting the backspace key. I do it on promp using the command stty erase - This command stops the... (5 Replies)
Discussion started by: mobile01
5 Replies

9. Shell Programming and Scripting

Catching ctrl-C or ctrl-D

Hi there, I'm using HP-UX 11 machine. I am running a script, thats gonna take a long time to execute. When I press ctrl-c to come out of my script, I have to catch that signal(ctrl-c) and display that ctrl-c had been pressed. How can I do it. Thanks in advance (2 Replies)
Discussion started by: sendhilmani123
2 Replies

10. Shell Programming and Scripting

how to enable Ctrl + C in ksh

hi there , server is AIX 5.3 , login shell is ksh , stty -a display as following #stty -a speed 9600 baud; 21 rows; 80 columns eucw 1:1:0:0, scrw 1:1:0:0: intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ^@ eol2 = ^@; start = ^Q; stop = ^S; susp = ^Z; dsusp = ^Y; reprint = ^R... (0 Replies)
Discussion started by: dradhzn
0 Replies
Login or Register to Ask a Question