What is umask?
It is a number which define the default permissions which are not given on a file or directory.
Calculation of Umask:
You can simply subtract the umask from the base permissions to determine the final permission for file as follows.
Suppose umask 000
It means User has 0, Group has 0 and other has also 0
It means folder permission
User permission is 7-0 =7 (Read, Write and Execute)
Group Permission is 7-0 =7 (Read, Write and Execute)
Other Permission is 7-0 =7 (Read, Write and Execute)
Suppose umask 002
It means User has 0, Group has 0 and other has 2
It means folder permission
User permission is 7-0 =7 (Read, Write and Execute)
Group Permission is 7-0 =7 (Read, Write and Execute)
Other Permission is 7-2 =5 (Read and Execute)
Suppose umask 022
It means User has 0, Group has 2 and other has 2
It means folder permission
User permission is 7-0 =7 (Read, Write and Execute)
Group Permission is 7-2 =5 (Read and Execute)
Other Permission is 7-2 =5 (Read and Execute)
Suppose umask 027
It means User has 0, Group has 2 and other has 2
It means folder permission
User permission is 7-0 =7 (Read, Write and Execute)
Group Permission is 7-2 =5 (Read and Execute)
Other Permission is 7-7 =0 (No permission)
Umask | User permission | Group permission | Others permission |
000 | all | all | all |
002 | all | all | read & execute |
022 | all | read / execute | read / execute |
027 | all | read / execute | No permission |
How to find out the umask value?
$ umask 0022
How to change the Umask?
$ umask 002