The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > AIX
Google UNIX.COM


AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Disable and Enable Backspace or Ctrl^H in vi mobile01 UNIX for Advanced & Expert Users 5 11-24-2006 07:55 AM
terminating script with CTRL+D sanchopansa Shell Programming and Scripting 12 10-26-2006 01:22 AM
Catching ctrl-C or ctrl-D sendhilmani123 Shell Programming and Scripting 2 05-02-2006 02:02 PM
How to secure my script from Ctrl-C jhansrod Shell Programming and Scripting 12 05-17-2005 08:38 AM
Script ctrl+c newtounix UNIX for Dummies Questions & Answers 1 03-19-2001 01:23 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-28-2005
Registered User
 

Join Date: Jun 2005
Posts: 7
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
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 06-28-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,354
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.
Reply With Quote
  #3 (permalink)  
Old 06-29-2005
Bughunter Extraordinaire
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,032
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
Reply With Quote
  #4 (permalink)  
Old 06-29-2005
Registered User
 

Join Date: Jun 2005
Posts: 7
Sorry! I renamed the srcipt dumm.ksh as .profile, it is still able to enter ctrl-c to be at system prompt. Please help
Reply With Quote
  #5 (permalink)  
Old 06-29-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,354
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.
Reply With Quote
  #6 (permalink)  
Old 06-29-2005
Bughunter Extraordinaire
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,032
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
Reply With Quote
  #7 (permalink)  
Old 06-29-2005
Registered User
 

Join Date: Jun 2005
Posts: 7
Thanks for of your help.... Works like a charm
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 05:03 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0