[RndTbl] How does umask really work?

Kevin McGregor kmcgregor at shaw.ca
Wed Feb 9 20:42:40 CST 2005


I think that it subtracts the umask value from the "default" file mask, 
not "777". The default is probably 666 (rw-rw-rw-), so a umask of 022 
would indeed produce 644. There is a way to set the "default" file mask, 
but that I don't know.

John Lange wrote:
> The documentation and examples on umask state that you provide a mask
> that is subtracted from rwx (777) access to generate a default access
> for newly created files.
> 
> It clearly doesn't work this way.
> 
> If you have a umask of 022, newly created files are rw-r--r-- (644). It
> should be rwxr-xr-x (755). The umask is acting like its 033 and indeed
> changing it to 033 has no effect on newly created files.
> 
> However, umask effects directories differently. umask 022 will create
> directories as expected (as 755), and umask 033 will create them as 644.
> 
> So how do you set a umask that will create files as 755?
> 

-- 
Kevin McGregor
9-1120 Dorchester Ave.
Winnipeg MB R3M 0S4
kmcgregor at shaw.ca


More information about the Roundtable mailing list