[Tfug] Setting default permissions on new files

Glen Pfeiffer glen at thepfeiffers.net
Wed Jun 2 13:31:56 MST 2010


On 02 Jun 2010, Ammon Lauritzen wrote:
> On Jun 2, 2010, at 11:43 AM, Glen Pfeiffer wrote:
> > [snip]
> > What I would like however, is for the group's write bit to set by
> > default as well. So it would look like this:
> >
> >  -rw-rw-r--  1 glen users         0 2010-06-02 11:26 test
> >       ^
> >
> > How would I accomplish that? I am aware of umask, but as far as I
> > can tell, graphical file managers (nautilus, thunar, etc) do not
> > honor that.
> > [snip]
> 
> It is my understanding that processes usually inherit umask 
> from parents unless overridden. So if you launch nautilus with 
> an open umask it should honor it unless it is manually 
> resetting permissions upon file creation?

I just tested this with both thunar and nautilus. In xterm, I 
issued the command "umask 002". Then started the file manager 
program from the same xterm. I created one directory, and one 
file.

Here's what it looks like when from the test with nautilus:
  drwxrwsr-x   2 glen users      4096 2010-06-02 13:23 test
  -rw-rw-r--   1 glen users         0 2010-06-02 13:23 testfile

Here's what it looks like when from the test with thunar ():
  drwxr-sr-x   2 glen users      4096 2010-06-02 13:26 test
  -rw-r--r--   1 glen users         0 2010-06-02 13:26 testfile


So nautilus does honor the umask from the parent but thunar does 
not. I only tested with thunar the first time, which is why I was 
under the impression that it would not work.

That does not seem to be an acceptable approach because I cannot 
confirm that every program that will be used to create 
files/directories will honor the umask of the parent process. I 
would prefer that every file or directory that is created, 
regardless which program creates it, will have the correct 
permissions.

Any ideas how to achieve what I want?

-- 
Glen 





More information about the tfug mailing list