How to calculate a umask for files
The umask will be 663 for this example. i.e. rw-rw--wx
The initial file permission is 666. i.e. rw-rw-rw-
The complement of the umask is 114. i.e. --x--xr--
Basically you want to take the complement of the owner, group and other parts from the initial and complements.
initial rw-rw-rw- complement --x--xr-- result ------r--
So the result is 004 for files created.
Setting the umask for directories
When setting the umask for directories use an initial permission of 777.
References
[Click to add or edit comments])
Please prepend comments below including a date