Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!att!chinet!ignatz From: ignatz@chinet.chi.il.us (Dave Ihnat) Newsgroups: alt.sources Subject: chmod args (was Re: Need a "watching" program) Summary: Octal chmod has definite uses Keywords: chmod Message-ID: <8605@chinet.chi.il.us> Date: 1 Jun 89 18:14:24 GMT References: <8923@csli.Stanford.EDU> <11680@s.ms.uky.edu> <8928@csli.Stanford.EDU> <12743@ihlpy.ATT.COM> <1953@ur-cc.UUCP> <2126@amelia.nas.nasa.gov> Reply-To: ignatz@chinet.chi.il.us (Dave Ihnat) Distribution: usa Organization: Analysts International Corp. Lines: 34 >In article <12743@ihlpy.ATT.COM> bdavies@ihlpy.UUCP (55314-Davies,B.) writes: >Really. *I* know what you all mean, but why does everyone teach the >octal way when these mnemonic ways exist that are so nice and easy to >understand for everyone? Don't you all believe in abstraction? Actually, they still have two different and useful functions. The mnemonic method is a mask, while using the octal is a total reset. So, the mnemonic is simpler if I just want to toggle a particular permission; I don't need to be sure to not destroy other bits: Old permission Desired Permission Octal arg. Mnemonic arg. 777 774 774 o-wx,o+r Notice that if I didn't know the old permission--say, in a shell script-- the mnemonic, while still a bit verbose, is still simpler than the shellish to extract the old values, mask in only those I want to change, and then execute the chmod. On the other hand, if I'm installing a program and have definite ideas about the permissions I want to set, then the octal form is cleaner: Desired Permission Octal arg. Mnemonic arg. 2710 2710 u+rwx,g+xs,g-rw,o-rwx At this point, the octal mask is cleaner, since you still have to do the mental dance to interpret the now rather long mnemonic string. Finally, I firmly believe that it's an absolute necessity for even casual Unix users to fully understand file permissions; most security violations on Unix can be traced to user carelessness, either due to misunderstanding or simple lack of care when dealing with file permissions. There are some quite decent interactive tools in the PD to allow naieve users to manipulate their permissions without resort to either bitmasks or the rather dense mnemonics of chmod, if this is a problem.