Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 08 Jul 2008 11:31:04 +0100
From:      Dez Accid <dez@accid.net>
To:        freebsd-questions@freebsd.org
Subject:   Re: How to disable that an user execute any command
Message-ID:  <487341E8.9050203@accid.net>
In-Reply-To: <50744.217.114.136.134.1215506711.squirrel@mail.dsa.es>
References:  <50744.217.114.136.134.1215506711.squirrel@mail.dsa.es>

next in thread | previous in thread | raw e-mail | index | archive | help
DSA - JCR wrote:
> I want to make an user for the only task of remove/insert the usb copy disk.
>
> I have made a new user (operator group), and a shell task that ask for the
> GELI password and fsck and mount the USB disk. This work fine under root.
>
> but I think that if he/she want to make CTRL-C to the shell task, he can
> stop the task and then enter in the system and look whatever he wants (for
> example, how the things are done).
>
> How can I stop him from entering this CTRL-C (and others than could be) ?

If I understand your question correctly, you want to prevent an 
interactive user running a shell script from breaking out of it via 
CTRL-C and entering the shell directly.

In that case, you can achieve this functionality in your shell script 
with the use of trap command.

E.g. this line will print "Ignoring CTRL-C" on CTRL-C keypress which 
generates an INT (number 2) signal:

trap "echo 'Ignoring INT signal'" 2

This page http://www.shelldorado.com/goodcoding/tempfiles.html describes 
the shell signals quite well, you may want to give it a read.

Thanks!

-- 
Dez Accid




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?487341E8.9050203>