1834814 Members
3171 Online
110070 Solutions
New Discussion

Ctlr ^C denied to a user

 
SOLVED
Go to solution
Sirius Black
Regular Advisor

Ctlr ^C denied to a user

Hi all,
I want that a user could not do ctrl ^C with his keyboard to stop a process, what I could do in the .profile file of the user or in my script ?
thanks a lot
9 REPLIES 9
Victor BERRIDGE
Honored Contributor

Re: Ctlr ^C denied to a user

Add in his .profile:
trap 'echo "^G^G^G" ;' 1 2 15


All the best
Victor
RAC_1
Honored Contributor
Solution

Re: Ctlr ^C denied to a user

As tolad by vitor putting
trap "" 1 2 3

Will ignore siganls
1-HUP
2-INT
3-QUIT

But a knowledgable user can alway modify that as trp 1 2 3

Anil
There is no substitute to HARDWORK
Sirius Black
Regular Advisor

Re: Ctlr ^C denied to a user

Unfortunatelly it doesn't works, my user succeed still in doing ctrl ^C an stop my process
Fred Ruffet
Honored Contributor

Re: Ctlr ^C denied to a user

you can also set for this user intr to another keystroke the he doesn't know :
stty intr ^=

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Victor BERRIDGE
Honored Contributor

Re: Ctlr ^C denied to a user

Did he loo out and log in again?
Has he modified his .profile?
is he accessing by X ? which means he is not reading .profile...

Sorry for the inconvenience but these last 2 weeks I just cant get my eyes to accommodate correctly -I just changed glasses but seem to still have trouble with my screen and keyboard... I apologize!
Victor
RAC_1
Honored Contributor

Re: Ctlr ^C denied to a user

Once you put those entries in user's .profile. Ask him to log out and log in.

As said earlier, a knowledgable user can always overide it with command trp 1 2 3

You can also start the program with nohup. man nohup. Program started started with nohup will not respond to HUP signal

Anil
There is no substitute to HARDWORK
Fabio Ettore
Honored Contributor

Re: Ctlr ^C denied to a user

Ciao,

as Fred directed the right way is intr in man stty.
For example for my users in $HOME/.profile there is a line as the following:

stty erase "^H" kill "^U" intr "^C" eof "^D"

as from /usr/newconfig/.profile.

If I delete intr "^C" to see

stty erase "^H" kill "^U" eof "^D"

that user cannot use CTRL+C to interrupt processes.

HTH.

Best regards,
Fabio
WISH? IMPROVEMENT!
Victor BERRIDGE
Honored Contributor

Re: Ctlr ^C denied to a user

But as Anil already said beware of knoledgable user, OK you remove from his .profile intr "^C" .
What going to stop him type stty intr....

All the best
Victor
Sirius Black
Regular Advisor

Re: Ctlr ^C denied to a user

OK with trap "" 1 2 3 I've resolved
Ciao Fabrizio