3

I've set my umask in my .bashrc file to 007. Any files created on the command line after loading my bashrc file respects this setting. I want to be able to set the umask to 007 for any files created using non-command line apps.

This document talks about setting the umask via launchd. And it kind of works. If I follow these directions I can change the default permissions on a GUI created file from rw-r--r-- to rw-rw---- but the directories still are not group writeable (i.e. I want them to be rwxrwx--- but they are rwxr-x--- instead)

The analog on Linux would be /etc/login.defs as the place to set the umask.

What do I change in order for the umask to be set properly (i.e. the way I want it)?

1 Answer 1

1

I think you have done what you could; the umask really is 077. When programs create files or directories via the mkdir system call, they specify a mode. The file or directory ends up with a mode which is the specified mode, but with any 1 bits from the umask cleared. So in all likelihood, the GUI programs create their directories with a specified mode 755, and if so, there is no change of the umask that will help. (If all GUI programs do this, it is probably because they all use the same library to create the directories they want to exist.)

3
  • By the way, you can run the command launchctl umask to ask your launchd process about its current umask value. Commented Mar 4, 2012 at 15:03
  • How do I understand the umask value returned by launchctl umask? I get a '7'. Is that --- --- rwx (i.e. o+rwx) Commented Mar 13, 2012 at 13:12
  • Indeed, 7 is the same as 007. But you have to remember that the 1 bits of the umask are turned off in the final result, so it would be better to think of that 7 as specifying o-rwx. When the umask is 7 and the program creates a directory specifying mode 755, the end result is 750, or u+rwx,g+rx. Commented Mar 13, 2012 at 15:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .