access() call as a su
Hugo Calendar
hugo at saturn.ucsc.edu
Wed Nov 14 18:08:37 AEST 1990
In article <681 at mara.cognet.ucla.edu> iwelch at agsm.ucla.edu (Ivo Welch) writes:
>On Mach, a BSD 4.3 clone with a gcc compiler:
>
>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.
>
>Is this a bug on my machine, or am I doing something wrong?
>
>/ivo welch ivo at next.agsm.ucla.edu
I just tried this out on machines running Mach, AIX, AOS and
SunOS 4.1, and I get the behavior you describe under all of
those operating systems. This must be a bug/inaccuracy in
access () since I can't execute a file that's not executable,
even as root.
I understand that root was once able to execute _any_ file,
but that that caused a lot of problems, and this "feature"
was removed; and thus root wasn't allowed to execute a file
unless it had at lease one of the execute bits set. Perhaps
access () was never modified when root lost the ability to
execute files w/o an execute bit set.
I tried executing a file as root from the c-shell, and through
the execl () call, and in both cases root couldn't execute a
file unless it had an execute bit set. This means that it's
not just the c-shell that won't let you execute non-executable
files, but it's the OS itself.
I'd recommend using the status () call to determind if you can
execute a file.
-Hugo
---
Hugo Calendar ...!ucbvax!ucscc!spica!hugo CmpEng/Math Undergraduate
215 Weeks Avenue hugo at saturn.ucsc.edu IBM RT AIX/Mach Sys Admin
Santa Cruz, CA 95060 hugo at ucscd.bitnet Work Phone (408) 459-3224
USA (408) 425-5479 Above at University of California, Santa Cruz
--
Hugo Calendar ...!ucbvax!ucscc!spica!hugo CmpEng/Math Undergraduate
215 Weeks Avenue hugo at saturn.ucsc.edu IBM RT AIX/Mach Sys Admin
Santa Cruz, CA 95060 hugo at ucscd.bitnet Work Phone (408) 459-3224
USA (408) 425-5479 Above at University of California, Santa Cruz
More information about the Comp.unix.questions
mailing list