inconsistency on read/execute permissions for shell procedures

Timothy Gill gill at wanginst.UUCP
Wed Jul 3 00:37:34 AEST 1985


All of the UNIX documentation I read states that programs and other
executable files (shell procedures) are equivalent.  Yet I find that a
file with the permissions

	-rwx--x--- 

will execute for members of my group if it is a program but will not
execute if it is a shell procedure.  For a shell procedure to run for
those users, there must also be read permission on the file:

	-rwxr-x---

This is the case when my interactive shell is either "sh" or "csh".

This is clearly inconsistent.  Some people have tried to explain it to
me by saying that a shell procedure must be "read" by the shell to be
executed and that this is the reason the read permission must be there;
if this is so, why cannot the same reasoning me made for program
files?  They have to be "read" just as much as shell procedures.

The problem is that I wish some shell procedures to be executable by
other users without being readable by them, and the structure and
consistency of the UNIX file permission system leads me to believe that
this is possible.  However, I cannot make it happen.  Can someone inform
me how to make a shell procedure executable without it also being 
readable by others?

Nothing I have read states that the read permission must be set.  For 
example, Section 2.0 of Bourne's "An Introduction to the UNIX Shell"
states:

     UNIX files have three INDEPENDENT [my emphasis] attributes,
     "read", "write" and "execute". The UNIX command "chmod" (1)
     may be used to make a file executable.  For example, "chmod +x
     wg" will ensure that the file wg has execute status.
     Following this, the command "wg fred" is equivalent to "sh wg
     fred".  This allows shell procedures and programs to be used
     interchangeably.
     
So, can someone explain this UNIX inconsistency?

Responses mailed to me will be summarized for this group.

[We run Ultrix 1.0 (BSD 4.2)].



More information about the Comp.unix mailing list