Well, umask also applies to creating new files. Think of the umask setting as turning off the permissions it lists. If you're like me, and have a problem thinking that using a value means the opposite will come out, then think of it using subtraction. In other words, remember that all files can have a permission value of 777. When you create a file, you subtract the umask from 777.
So, if you have a umask of 022 (which is very common), then a new file created will have permissions of 777 - 022 = 755 (owner has all perms, group and other have read and execute perms).
One gotcha is this: the application that creates the file sometimes does not give the execute permission by default. For instance, if you used the touch command with a umask of 022, the file you create would be 777 - 111 (touch does not give execute) - 022 = 644 (owner has read & write, everybody else only has read).
Clear as mud?
|