Search code examples
linuxunixpermissionsumask

With a umask value of 457 it should come as w, x, - 210 (666-457) but instead i am seeing it as w,w,-..(220). why is that?


you can find the snapshot of the error here

With a umask value of 457 it should come as w, x, - 210 (666-457) but instead i am seeing it as w,w,-..(220). why is that?


Solution

  • Let's break this down: umask does not do substraction, but rather a bitwise operation. It works by switching off the bits in the premission that are set on the umask, so in this case:

    6: 110 4:100 -> 010 ->2
    6: 110 1:101 -> 010 ->2
    6: 110 7:111 -> 000 ->0
    

    Does that help?