Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ames!sun-barr!texsun!pitstop!sundc!seismo!uunet!mcvax!hp4nl!botter!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.unix.questions Subject: Re^2: Testing execute permission from csh Message-ID: <2489@kappl.cs.vu.nl> Date: 10 May 89 22:41:16 GMT References: <19486@adm.BRL.MIL> <14660010@hpsal2.HP.COM> Organization: V.U. Informatica, Amsterdam, the Netherlands Lines: 41 morrell@hpsal2.HP.COM (Michael Morrell) writes: \/ hpsal2:comp.unix.questions / Kemp@DOCKMASTER.NCSC.MIL / \6:33 pm May 5, 1989 / \... \ -rw-r----- root a.c \ -rw-r----- root b.c \ -rwxr-x--- root a.out \... \ # foreach f (*) \ ? if -x $f chmod o+x $f \ ? end \ \and it selected EVERY file, not just those with execute permission. (I \actually used echo instead of chmod while testing). If I do the same \thing as a normal user, it works properly. \ \---------- \ \ I think since the superuser can execute any file even if it has mode 000, Wrong! The superuser needs AT LEAST ONE x-bit turned on. \csh tries to do you a favor and always returns true for "-x" if you are root \(same goes for "-r" and "-w"). I don't know if I like this "feature". It's a bad feature, but this time it's NOT csh's fault! (Unbelievable :-) Esteemed members of the Jury, the guilty is... access(2)! Something like: /* * If you're the super-user, * you always get access. */ if (cred->cr_uid == 0) return (0); :-( -- "`Goto considered harmful' considered |Maarten Litmaath @ VU Amsterdam: harmful" considered harmful! |maart@cs.vu.nl, mcvax!botter!maart