For example, for the u m a s k value 0 0 2, what is the default creation permission for the corresponding files and directories?
Step 1: Write down the mode with all permissions, namely 7 7 7 (all users have read, write, and execute permissions ).
Step 2: Write the corresponding bits in the following line according to the u m a s k value. In this example, It is 0 0 2.
Step 3: In the next row, remember that no matching BITs exist in the above two rows. This is the default directory creation permission.
Remember this method with a little practice.
Step 4: For a file, you cannot have the file permission when creating the file. You only need to remove the corresponding execution permission bit, that is
Yes.
In this example, the u m a s k value is 0 0 2:
1) Maximum File Permission: rwx (777)
2) umask value: 0 0 2--w-
3) directory permission: rwx R-X (775). This is the default permission for Directory Creation.
4) File Permission RW-r -- (664) This is the default permission for file creation.
The following is another example. Assume that the u m a s k value is 0 2 2:
1) Maximum File Permission: rwx (777)
2) u m a s k value is 0 2 2--w-
3) directory permission: rwx R-X (755). This is the default permission for Directory Creation.
4) File Permission RW-r -- (644) This is the default permission for file creation.