[wplug] umask

James O'Kane jo2y at midnightlinux.com
Tue Apr 29 13:57:37 EDT 2003


On Tue, 29 Apr 2003, Chris wrote:

> Now being that I am still new to Linux, I am not familiar with this.  The
> will change the permissions, right?  If I am running as root, why would I
> need to do this?  

umask is used when setting the default permissions on a newly created 
file:

[jo2y at dax /tmp]$ umask
022
[jo2y at dax /tmp]$ touch foo
[jo2y at dax /tmp]$ ls -la foo
-rw-r--r--    1 jo2y     users           0 Apr 29 13:48 foo
[jo2y at dax /tmp]$ umask 000
[jo2y at dax /tmp]$ umask
000
[jo2y at dax /tmp]$ touch bar
[jo2y at dax /tmp]$ ls -la bar
-rw-rw-rw-    1 jo2y     users           0 Apr 29 13:49 bar
[jo2y at dax /tmp]$ 



As you can see, when I had a umask of 000, bar was created with rw for 
everyone. When it was 022, the w bits on foo were masked.
At the moment, I don't remember what operation is used between the 
permissions and the umask to get the actually permissions used. umask is 
part of bash, so you could look at man bash for more.

-james





More information about the wplug mailing list