umask?

Marcelo Magno T. Sales marcelo.sales at sefaz.pe.gov.br
Wed Aug 24 15:32:11 UTC 2005


Hi,

> The simple explanation is that the value of umask will be subtracted from 
> the protection mask of whatever you create. If you are creating an 
> executable file and your umask is 022 then the resulting protection on the 
> file will be 777-022==755
> 

Subtracting umask from default permissions will work in many cases, but
not always. If you have a bit set in umask which is reset in
corresponding position in default permissions, you'll get wrong results
subtracting umask value from default permission value. (for example, if
you have 6 in default permission and 3 in umask, the resulting
permission will be 4, not 3).
To get the right results in all cases, you must calculate default
permission value AND (NOT umask value).

[]'s
Marcelo




More information about the fedora-list mailing list