How to disable that an user execute any command

Dez Accid dez at accid.net
Tue Jul 8 10:31:12 UTC 2008


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



More information about the freebsd-questions mailing list