how to disable keys in script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to disable keys in script
# 1  
Old 09-10-2008
how to disable keys in script

Hi there all..

How can I set keys to be disabled in a shell script menu?
So people cant escape the script with Ctrl+C or someting.
I have a menu people have to see and when they get out of the menu script they have to be logged off again.
That all works fine.
But when they Ctrl+C they just jump out of the script and back in the shell and can do anything they want.


Thanx!!
Draco
# 2  
Old 09-10-2008
You will need to use signal handling function to trap the signal and then do something. Read man pages for signal

cheers,
Devaraj Takhellambam
# 3  
Old 09-10-2008
Arrange for the shell script or program presenting the menu to be the login shell. Do not have a parent shell for them to escape to. A shell can replace itself with a line like:
exec /usr/local/bin/menuthing
but you should explore simply having /usr/local/bin/menuthing be the login shell given to the user in /etc/passwd.

And once you do this, allow them to escape at will, thus logging themselves off.
# 4  
Old 09-10-2008
Another possibility is to "exec" the script in the .profile of the user.

Regards
# 5  
Old 09-11-2008
To find out what control keys are set and what is on them, run the following command in a user context:
stty -a
For example to disable Ctrl/C in a script or the user's .profile .
stty intr ""
# 6  
Old 09-11-2008
Quote:
Originally Posted by draco
Hi there all..

How can I set keys to be disabled in a shell script menu?
So people cant escape the script with Ctrl+C or someting.
Code:
trap "" INT

See your shell man page for more information on trap.

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Send keys in shell script

Hi All, Consider we have script Linux server . But we don't have permission to edit that file. When run the script, it opens a file as "/tmp/xxx0000 .txt" with few contents. Most of the time the contents doesn't required to modify and they just save and close (:wq!). So the script continues... (7 Replies)
Discussion started by: k_manimuthu
7 Replies

2. Shell Programming and Scripting

SFTP or scp with password in a batch script without using SSH keys and expect script

Dear All, I have a requirement where I have to SFTP or SCP a file in a batch script. Unfortunately, the destination server setup is such that it doesn't allow for shell command line login. So, I am not able to set up SSH keys. My source server is having issues with Expect. So, unable to use... (5 Replies)
Discussion started by: ss112233
5 Replies

3. Shell Programming and Scripting

Executing a background script using ssh keys

Greetings, i've been working with a user-friendly menu on ksh to allow users execute scripts located on a remote server, so they wont have to login and manually launch those scripts every single time. This is a HP-UX box and currently on a /usr/bin/ksh shell. I've setup ssh keys on both... (1 Reply)
Discussion started by: nbriozzo
1 Replies

4. Shell Programming and Scripting

Shell script for SFTP using Public and private keys

Hi all, I needed a shell script for file transfering using public/private keys for authentication. Could you please help me out on this? A procedure to write a shell script is enough. Thanks in advance. Regards. Vidya N (8 Replies)
Discussion started by: Vidya N
8 Replies

5. Red Hat

SSL/TLS renegotiation DoS -how to disable? Is it advisable to disable?

Hi all Expertise, I have following issue to solve, SSL / TLS Renegotiation DoS (low) 222.225.12.13 Ease of Exploitation Moderate Port 443/tcp Family Miscellaneous Following is the problem description:------------------ Description The remote service encrypts traffic using TLS / SSL and... (2 Replies)
Discussion started by: manalisharmabe
2 Replies

6. Shell Programming and Scripting

Need an expect script to copy trusted keys

I would like an expect script that not only transfers over the trusted keys to remote hosts that I've never logged into before via ssh, but it also cats the trusted key into the ~/.ssh/authorized_ksys2 file. Essentially it would be like combining the two scripts below. But I would rather stay away... (2 Replies)
Discussion started by: master-of-puppe
2 Replies

7. Shell Programming and Scripting

Script to authorize keys ....

Hello!! I am trying to write a script to verify if theres an id_rsa.pub, if not then create one. After creating one to send it to antoher servers authorization keys file. Hope that makes sense-lol. Heres what I have so far: Cd .ssh Cat id_rsa.pub If not then ssh-keygen -t rsa Then... (3 Replies)
Discussion started by: bigben1220
3 Replies

8. Shell Programming and Scripting

How to disable Enable/Disable Tab Key

Hi All, I have bash script, so what is sintax script in bash for Enable and Disable Tab Key. Thanks for your help.:( Thanks, Rico (1 Reply)
Discussion started by: carnegiex
1 Replies

9. SuSE

Script to disable services

Hi All, I want to disable bunch of unused services on SLES and RHEL to improve the performance. Since we have more than 100 servers to disable services, I want to do with some script. Any one can give me an idea how to write a script to disable services. Thanks (1 Reply)
Discussion started by: s_linux
1 Replies

10. UNIX for Dummies Questions & Answers

arrow keys / special keys

how to use the arrow keys in shell scripting. is there any special synatax / command for this. i just want to use the arrow keys for navigation. replies appreciated raguram R (3 Replies)
Discussion started by: raguramtgr
3 Replies
Login or Register to Ask a Question