The umask
is typically set system wide through the config file: /etc/login.defs
:
$ grep UMASK /etc/login.defs
UMASK 077
This value can be overridden but typically is not through either /etc/bashrc
, /etc/profile
and/or by the users in their $HOME/.bashrc
(Assuming they're using Bash).
If you grep
for "umask" in those aforementioned files you'll also notice this on RHEL boxes:
$ grep umask /etc/bashrc /etc/profile
/etc/bashrc: # By default, we want umask to get set. This sets it for non-login shell.
/etc/bashrc: umask 002
/etc/bashrc: umask 022
/etc/profile:# By default, we want umask to get set. This sets it for login shell
/etc/profile: umask 002
/etc/profile: umask 022
Digging deeper:
/etc/bashrc
# By default, we want umask to get set. This sets it for non-login shell.
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
umask 002
else
umask 022
fi
/etc/profile
# By default, we want umask to get set. This sets it for login shell
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
umask 002
else
umask 022
fi
So at least on RHEL system's the umask
is either 002
if your UID is greater than 199, and 022
otherwise (system accounts).