chmod args (was Re: Need a "watching" program)

Dave Ihnat ignatz at chinet.chi.il.us
Fri Jun 2 04:14:24 AEST 1989


>In article <12743 at ihlpy.ATT.COM> bdavies at 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.



More information about the Alt.sources mailing list