Question about umask

Peter Arremann loony at loonybin.org
Tue Jan 18 04:05:11 UTC 2005


On Monday 17 January 2005 23:04, chi wrote:
> iin /etc/bashrc the umask is 022
> then why when i create file , the permission is 664 not 755
> Thx

The umask masks the permission the program you're working with uses. So if the 
program tries to create files with 664 permissions and your umask is 022, you 
will end up with 644. 
By default most programs create 664. the lowest numbered bit is the executable 
bit and if you have data files there is no reason for having it set. 
Compilers for example create executables so they will set the x bit.

[loony at lap tmp]$ umask 022
[loony at lap tmp]$ cat a.c
int main () {
        return 1;
}
[loony at lap tmp]$ gcc -o a a.c
[loony at lap tmp]$ ls -la a
-rwxr-xr-x  1 loony loony 4617 Jan 17 23:04 a
[loony at lap tmp]$


Peter.




More information about the users mailing list