How to trap !sh at keyboard

Paul Dwerryhouse paul at dwerryhouse.com.au
Fri May 23 23:27:33 UTC 2008


On Fri, May 23, 2008 at 01:53:20PM -0400, Billy Davis wrote:
> It seems that some of  our users are inclined to key in '!sh' at the  
> shell prompt, which promptly shuts down our Red Hat Enterprise 3 Server,  
> interrupting everyone else's work.  Is there a line that we can add to  
> the inittab file, that will trap this string, in the same fashion that  
> the 'ca::ctrlaltdel:/sbin/shutdown -t3 -r now' line traps  
> Ctrl-Alt-Delete inputs?

Dodgy answer: move /sbin/shutdown to a location that isn't in the path,
so that typing just 'shutdown' from a command line without the full path
to it will result in 'command not found'.

Better answer: take root access away from users who aren't sensible
enough to know how to use it properly. If they *have* to have root
access for some reason (and I really can't think of any reason why they
should have it), force them to use sudo with a restricted range of
commands that they need.

Cheers,

Paul

-- 
Paul Dwerryhouse                             	| PGP Key ID: 0x6B91B584
========================================================================

http://linoleum.leapster.org/ - Linux Programming Resources




More information about the redhat-list mailing list