[RndTbl] How does umask really work?

Kevin McGregor kmcgregor at shaw.ca
Wed Feb 9 20:52:04 CST 2005

On second thought (and after checking one book on bash), there may not 
be a "default". If a text editor tries to create a file with permissions 
666 and umask is 022, then it will be created with 644 instead. So it 
seems to depend on the process creating the file. Gilbert confirms this.

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