This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
unix:file_permissions [2023/08/17 10:17] manu [Ownership and groups] |
unix:file_permissions [2023/08/17 11:00] (current) manu [Umask: file creation rights] |
||
---|---|---|---|
Line 191: | Line 191: | ||
</cli> | </cli> | ||
- | My file is created with permissions | + | The flag consists of three octal digits, each representing the permissions masks for the user, the group, and others. The default permissions are determined by subtracting the umask value from ‘777’ for directories and ‘666’ for files. The default value of the umask is ‘022’. |
+ | |||
+ | My file is created with permissions **666-022=644** | ||
+ | |||
+ | On **AIX** a umask is specified by default into **/etc/security/user**, you can specify one per user | ||
+ | # chuser umask=022 user01 | ||
+ | |||
+ | On **linux** the default mask is defined into **/etc/bashrc**, maybe also into **/etc/login.defs**. For custom, you can either add into homedir from every user, or globaly by script, you can add it to /etc/bashrc | ||
+ | <code> | ||
+ | if [ $UID -gt 199 ] && [ $(/usr/bin/id -gn) == $(/usr/bin/id -un) ] | ||
+ | then | ||
+ | umask 444 | ||
+ | else | ||
+ | umask 555 | ||
+ | fi | ||
+ | </code> |