The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > 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 11:55 AM
terminating script with CTRL+D sanchopansa Shell Programming and Scripting 12 10-26-2006 04:22 AM
Catching ctrl-C or ctrl-D sendhilmani123 Shell Programming and Scripting 2 05-02-2006 05:02 PM
How to secure my script from Ctrl-C jhansrod Shell Programming and Scripting 12 05-17-2005 11:38 AM
Script ctrl+c newtounix UNIX for Dummies Questions & Answers 1 03-19-2001 05:23 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-28-2005
wtofu wtofu is offline
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
  #2 (permalink)  
Old 06-28-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
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 (permalink)  
Old 06-29-2005
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
  
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,628
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 (permalink)  
Old 06-29-2005
wtofu wtofu is offline
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
  #5 (permalink)  
Old 06-29-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
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 (permalink)  
Old 06-29-2005
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
  
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,628
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 (permalink)  
Old 06-29-2005
wtofu wtofu is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 7
Thanks for of your help.... Works like a charm
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:23 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0