Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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)?

share|improve this question
add comment

1 Answer

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.)

share|improve this answer
    
By the way, you can run the command launchctl umask to ask your launchd process about its current umask value. –  Harald Hanche-Olsen Mar 4 '12 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) –  Avery Chan Mar 13 '12 at 13:12
    
BTW, this might be the best answer(which is why I'm upvoting your answer) but it doesn't solve the problem :( which isn't your fault... I'm hoping someone has a solution for this. That's why I'm not marking it as the accepted answer. –  Avery Chan Mar 13 '12 at 13:13
    
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. –  Harald Hanche-Olsen Mar 13 '12 at 15:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.