LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-21-2004, 05:13 PM   #1
quack322
LQ Newbie
 
Registered: Jun 2004
Distribution: Redhat 9
Posts: 11

Rep: Reputation: 0
Disable ctrl - c for users


I need the logged on users to only have access to my shell script in /scriptt/script . I had linux to start that shell script when the user logs in but I have found that the user can still crtl - c to the bash prompt.
is thier some way to prevent this?
 
Old 08-21-2004, 05:22 PM   #2
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
Set that as their shell in /etc/passwd? Any change permissions of bash and other shells?
 
Old 08-21-2004, 05:42 PM   #3
quack322
LQ Newbie
 
Registered: Jun 2004
Distribution: Redhat 9
Posts: 11

Original Poster
Rep: Reputation: 0
Question

Ive tried that and it works at the terminal But when i try to login through an ssh client it says Exec format error. So i put the script in etc/skel which would put it in every users .bash_profile and it worked. but they can still ctrl - c .

Last edited by quack322; 08-21-2004 at 09:36 PM.
 
Old 08-21-2004, 11:38 PM   #4
crabboy
Moderator
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 120Reputation: 120
You need to catch the interrupt signal in your scripts.

Search LQ for keyword: SigInt and user crabboy. You'll see a couple of examples.
 
Old 08-22-2004, 02:17 AM   #5
evilchild
Member
 
Registered: Sep 2003
Location: 127.0.0.1
Distribution: *bsd, solaris, gentoo
Posts: 86

Rep: Reputation: 15
Hello quack322,

Add the following code toward the top of your script
Code:
function nobreak()
{
#change this to what ever you want it to say when a user presses ctrl-c 
echo "You cannot use that command"
}
This defines a function that you will need to prevent users from pressing ctrl-c

I'm assuming that your script contains some type of loop, to allow users to execute commands or something of that nature probably an until statement
Right under where this loop starts (whatever it may be) add the following
Code:
trap nobreak  INT
What this does is call the function named 'nobreak' every time the user presses ctrl-c

btw: Could you post the code so i can be more specific on where these entrys should go.

Good luck
 
Old 08-22-2004, 10:14 AM   #6
cracauer
Member
 
Registered: Jul 2004
Location: Boston, MA, USA
Distribution: FreeBSD, Debian/AMD64, Ubuntu/i386
Posts: 59

Rep: Reputation: 15
Don't fiddle with this stuff if it is really security-releated. Anybody with more knowledge than you will break out.

E.g, ask the above posters about Control-\
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to disable password changing permissions to normal users ? toraghun Linux - Newbie 14 11-17-2005 10:17 AM
Disable Viewing Users in /home gsoft Linux - Security 2 09-09-2005 01:32 AM
How To Disable CTRL-ALT-F1 beajedi Linux - Security 6 12-23-2004 11:07 PM
How to disable Ctrl and Alt keys? (and maybe sysrq) bigperk420 Slackware 13 12-07-2004 05:53 PM
Disable CTRL-ALT-DEL dog606 Red Hat 2 04-19-2004 01:25 PM


All times are GMT -5. The time now is 01:07 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration