Fri, 19 Aug 2005 00:29 +1000, thus spake Netocrat <netocrat@dodo.com.au>:
Thu, 18 Aug 2005 07:49:06 -0700, matt_left_coast wrote:
>
>Lucas wrote:
>[]
I would like to make some exercises for a small AIX training. To do
this I want to make a few scripts that do something evil to the S
(corrupting the bootblock or filling the tmp filesystem to the last
bit something like that) Then the students should fix it.
The problem is that if they view the script that does this, they see
the answer right away. (instead of having to troubleshoot the whole
thing).
Anybody suggestions on how to hide what the script is doing?
>[]
>
>? Damn, you are instructing people and you don't know how to set the
>permissions of a script file to be readable only by the owner and root??
>I feel sorry for the people you are training.
>
A shell script must be readable by the user executing it since the shell
must be able to read it.
I thought about not responding since this seemed like possibly
feeding some nefarious endeavor but, thinking again,
such hiding of a script is easy to overcome by root.
The way you do this is:
chgrp bin myscript
chmod 2551 myscript
The file is now executable by world but not world-readable.
And interesting sidenote to this (and hopefully someone can answer this)
is that use of `basename $0` in such a non-readable but executable script
has unexpected results. The script, which formerly would have
been identified by `basename $0` as "myscript" is now shown by
the Bourne shell as "4". This refers to /dev/fd/4
but why? Can anyone answer this? Stephane? Chris?
Dave Robbins