Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.unix.wizards Subject: Re: Unix security automating script Message-ID: <3069@auspex.auspex.com> Date: 22 Mar 90 19:43:30 GMT References: <22817@adm.BRL.MIL> <1083@kcdev.UUCP> Organization: Auspex Systems, Santa Clara Lines: 32 >>find / -type d -perm -0002 -print ... >To do this under SysV use: > > >find / -type d -perm -002 -print > ^^^ Are you trying to say that you need to use a different number of leading zeroes in System V? I just checked the 4.3BSD "find" and the System V Release 3 "find", and the code that handles the "-perm" option when parsing the command line, and that executes the "perm" test when doing the tree walk, is *identical* in the two versions of "find" (as in "the only difference in the source code, if any, is in white space between C tokens" - the comparison code I was using ignores white space, including new lines). What the *documentation* says is: -perm onum True if the file permission flags exactly match the octal number onum (see chmod(1V)). If onum is prefixed by a minus sign, more flag bits (017777, see chmod(1V)) become sig- nificant and the flags are compared: (flags&onum)==onum. which doesn't say bugger all about leading zeroes - all it talks about is a leading "-". The code (in both versions of "find", natch) *always* treats the argument as an octal number (just as the documentation says!), and doesn't treat leading zeroes specially.