Question about umask

Jeff Vian jvian10 at charter.net
Tue Jan 18 13:58:11 UTC 2005


On Tue, 2005-01-18 at 12:04 +0800, chi wrote:
> iin /etc/bashrc the umask is 022
> then why when i create file , the permission is 664 not 755
> Thx
> 

2 reasons.
first:  By default a file is never created with the executable bit set,
but directories are.
Thus, a umask of 022 will create directories with 755 but files with 644
permissions.

Second:  The settings in /etc/bashrc are overridden by later settings.
I suspect that you may have a umask of 002 set in ~/.bashrc or
~/.bash_profile

To find out what your umask currently is use the command "umask".  Mine
gives
[jeff at goliath ~]$ umask
0002

Also, in my /etc/bashrc I see this related to the umask
--------------------------
if [ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ]; then
        umask 002
else
        umask 022
fi
--------------------------------------------
Which says if your uid == gid and your id is >99 then use 002, otherwise
use 022.  That explains mine. (uid=500, gid=500).






More information about the fedora-list mailing list