What is umask in Linux? Umask stands for user mask or user file creation mask.Default permission or base permission give when a new file or folder is created in linux. In linux it is 022(0022)is default umask.
Overview of umask in Linux
Umask stands for user mask or user file creation mask.Default permission or base permission give when a new file or folder is created in linux. In linux it is 022(0022)is default umask.
shakti@mydomain.com# umask shakti@mydomain.com# 0022
Now we learn how to set new umask and the calculate the file permission over new file or folders.
Key Points of Umask
:
umask
value for a folder is 000 to 777.
umask
value for a file is 000 to 666.
Decimal Binary Premissions umask 0 000 --- rwx 1 001 --x rw- 2 010 -w- r-x 3 011 -wx r-- 4 100 r-- -wx 5 101 r-x -w- 6 110 rw- --x 7 111 rwx (none)
Calculate umask for folder
1. First find the not for giving umask
.
2. Do logical AND with max permission
example:
If we have umask
is (023) then calculate the file permission over folder.
1. NOT(023) = 754
2. 777 AND 754 = 754
Shortcut method to calculate umask
is simply subtracted umask
from max value the you will get the actual value the folder have permissions.
777 – 023 = 754
Your comments are welcome to improve this post. Happy Learning 🙂