access() call as a su

Barry Margolin barmar at think.com
Wed Nov 14 19:25:56 AEST 1990


In article <681 at mara.cognet.ucla.edu> iwelch at agsm.ucla.edu (Ivo Welch) writes:
>I am trying to establish if a file has the executable  attribute set. access()
>works just fine if I am not  the su, or if  I su name. However,  if I just su,
>(i.e. become root), all files appear to access() to be executable.

Unix files don't have an "executable attribute".  The protection mode
includes execute permission bits, though.  The superuser implicitly has
permission to do whatever it wants (i.e. it ignores the protection modes of
files -- that's one of the things that makes it "super"), including
executing files that it doesn't have execute access to according to the
mode.  The access() call determines whether the user (identified by the
process's real-userid and real-groupid) has permission to perform the
specified operations, so access() is behaving properly.

--
Barry Margolin, Thinking Machines Corp.

barmar at think.com
{uunet,harvard}!think!barmar



More information about the Comp.unix.questions mailing list