Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Permissions Question
13adam13
I know this seems a simple question, but, can anyone please explain to me amask and omask?
I think I get it, but I am having a hard time explaining it(which probably means that I don't really get it).
--Adam Wilson
Senior Programmer
Find more posts tagged with
Comments
nipper
AND and OR
permissions are: RW with the amask applied (R) gives R
permissions are: RW with the omask applied (R) gives RW
brush up on your octal & check out the chmod man page
HTH Andy
13adam13
I get the octal thing, just not sure I get the logic behind the and/or.
If I have a file with perms 0664, and an amask of 0744, the end result would be 0764? So it takes the higher number between the two?
And then, does omask do the opposite, where it takes the lower number betwen the two?
so the result would be 0644?
or, on the omask, is it file perms minus the omask?
--Adam Wilson
Senior Programmer
nipper
remember how a bitwise AND works.
664 AND 744 = 644
110.110.100 AND 111.100.100 = 110.100.100
664 OR 744 = 764
you do the math...
JonathonG
You have to think of the numbers in their binary representation.
So, 0664 equates to the following in binary:
110 110 100
And, 0744 equates to:
111 100 100
Then, you do bit-by-bit and/or.
So, 0664 AND 0744 gets:
110 100 100 (or 0644)
0664 OR 0744 gets:
111 110 100 (or 0764)
It's not really about choosing the higher or lower number. It's about what bits are "on" in each number.
An extreme example: 0600 AND 0100 equates to 0000, while 0600 OR 0100 equates to 0700.
Hope this helps. If not, you probably need to read up on bitwise manipulation
Jonathon
Independent Interwoven Contractor