5 thoughts on “Speed traps with chmod”

  1. Thanks for in­ter­est­ing read­ing.

    You have small typo:
    “When you spec­ify g+w, it means to re­move the write ac­cess for the group…” 

    It should be “g-​w”

  2. The ex­amples are just ex­amples. I did not in­tend to give the same ex­amples for ab­so­lute and re­l­at­ive nota­tion (which is im­possible without show­ing a file/​directory with spe­cif­ic ac­cess rights). g+w adds group write ac­cess no mat­ter what oth­er set­tings are there, where­as the ab­so­lute ex­amples do not keep the re­main­ing ac­cess rights. Please do not com­pare them.

  3. Cur­rent chmod com­mand im­ple­ment­a­tions have already read the stat struc­ture be­fore set­ting the new per­mis­sions (checked on FreeBSD and Sol­ar­is source), so there is really no be­ne­fit for ab­so­lute mode over sym­bol­ic mode.

    Even ab­so­lute mode is not 100% ab­so­lute. For non-​regular files the in­ter­pret­a­tion is im­ple­ment­a­tion de­pend­ent. Quot­ing Sol­ar­is man page for chmod(1):
    For dir­ect­or­ies, the set­gid bit can­not be set (or cleared)
    in ab­so­lute mode; it must be set (or cleared) in sym­bol­ic
    mode us­ing g+s (or g-​s).

    Also the in­ode should already be in the in­ode cache. Even find needs the stat struc­ture (-type f).

Leave a Reply

Your email address will not be published. Required fields are marked *