Umask: Difference between revisions
Appearance
Content deleted Content added
Splatterbug (talk | contribs) m no change just note to fix my last changelog comment .. (AND combined with NOT of compliment) is OR |
No edit summary |
||
Line 1: | Line 1: | ||
{{lowercase|title=umask}} |
{{lowercase|title=umask}} |
||
'''umask''' (abbreviated from '''''u'''ser file creation mode '''mask''''') is a [[Function (programming)|function]] on [[POSIX]] environments which sets the default file system mode for newly created files of the current process. To create files with given permissions, the corresponding umask value can be |
'''umask''' (abbreviated from '''''u'''ser file creation mode '''mask''''') is a [[Function (programming)|function]] on [[POSIX]] environments which sets the default file system mode for newly created files of the current process. To create files with given permissions, the corresponding umask value can be calculated using two equivalent methods: (note that umasks must always be calculated in '''[[Octal|octal]]''') |
||
- [[Bitwise_operation#XOR|bitwise exclusive OR]] operation of the argument and the full access mode ''777''. |
- [[Bitwise_operation#XOR|bitwise exclusive OR]] operation of the argument and the full access mode ''777''. |
Revision as of 09:44, 20 June 2006
umask (abbreviated from user file creation mode mask) is a function on POSIX environments which sets the default file system mode for newly created files of the current process. To create files with given permissions, the corresponding umask value can be calculated using two equivalent methods: (note that umasks must always be calculated in octal)
- bitwise exclusive OR operation of the argument and the full access mode 777.
- bitwise AND of the unary complement of the argument (using bitwise NOT) and the full access mode 777.
Most Unix shells provide an umask command that affects all child processes executed in this shell.
Examples
To set the mode of newly created files to 0600 (-rw------) we need
7778 ^ ~1778 = 6008
Thus, umask has to be run with the value 177:
umask 177