I want to check whether a file on Linux has permission 555, but the file has a 755 permission instead.
So I do a boolean AND in my program:
if ((perm_of_file && perm_required) == 555)
i.e. (755 && 555 == 555)
Should this evaluate to true?
I know this is not intuitive from a programming prospective and the real background question is:
Is 755 considered as a “member” of the 555 permission group?
What I tried:
I use find -perm 555 on Linux and it doesn’t list those files who has 755 permission, so I am guessing the answer to the question is NO?
If somebody can help me answer or rephrase this question, that would be very helpful.
Thanks in advance!
1 Answer