Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Setting the Finder's default file mask System
Found this over at the Apple discussion forums...

By default, when saving a file or creating a folder, the object will be saved with permissions of 644 or 755; or a umask of 022. However, I need to have a umask of 002 such that my files turn out as 664 and 775. Sure the .cshrc file will sort that out for me in the terminal but not for applications.

The solution is to place the umask in your /etc/rc.common file, like so:
 ##
# Be strict
##
#set -e
set -u
umask 002
Not sure yet if there are any things to watch with this (like your application must be Cocoa, etc.) but seems to work for me.

[Editor's note: I have not tested this hint myself.]
    •    
  • Currently 2.33 / 5
  You rated: 1 / 5 (3 votes cast)
 
[15,626 views]  

Setting the Finder's default file mask | 10 comments | Create New Account
Click here to return to the 'Setting the Finder's default file mask' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
More Unix-ish
Authored by: sharumpe on Nov 14, '02 11:25:54AM

...would be to put this in your own .cshrc or .profile (in your home directory). Editing rc.common will change the umask for all users on the system, whereas putting it in your own config file (.cshrc or .profile) will change it only for you, which is usually better.

Of course, if you're the only user on the system, it's six for one, half dozen for the other.

Mr. Sharumpe



[ Reply to This | # ]
More Unix-ish
Authored by: mervTormel on Nov 14, '02 12:03:00PM

umask in the shell startup scriptage only affects files created in the shell, not cocoa or carbon apps.



[ Reply to This | # ]
More Unix-ish
Authored by: stuartbryson on Nov 14, '02 06:11:39PM

Correct! This is what I was having issues with. If my umask was set in the .cshrc file and I opened an application from the terminal it would work fine, but I needed it to work when opening applications from the finder (or window manager :))

Stuart



[ Reply to This | # ]
security
Authored by: imacusr on Nov 14, '02 06:00:09PM

Note that doing this means anybody in your OS X group (as in staff, wheel, admin, etc.) can write over your files if they so choose. Use caution!



[ Reply to This | # ]
security
Authored by: stuartbryson on Nov 14, '02 06:13:56PM

Thanks imacusr, this is the exact behaviour I needed as my work environment requires it.

Stuart



[ Reply to This | # ]
security
Authored by: kikjou on Nov 15, '02 04:18:41PM

Well, this is exactly what you want if you work in an environment where multiple users need read and write access to the same shared files. As to others in your group altering your files, make sure that your home directory's permissions are 700. This way, nobody can even see what is on your Desktop. I work in a research institution where collaboration is key and Apple's insistence on a umask of 022 has caused us quite some havoc. So far, this hint works on files and folders created by the Finder and by MS-Word.



[ Reply to This | # ]
caution!
Authored by: mervTormel on Nov 16, '02 10:07:11PM

this can really hose things. you'll notice that several files in /var/run are now mod'd to the umask perms when they are changed. a umask of 0077 hosed utmp and resolv.conf here, which broke uptime, who, and dig/nslookup.

and aqua apps did not mode to umask 0077



[ Reply to This | # ]
caution!
Authored by: alientech on Nov 17, '02 01:18:11PM

Is there a way to set the umask on files and folders created by the user to everyone = rwx and not muck up the system files and folders? I am looking for a way to do this. All my users share files all the time over a OS X server box on the network. As it stands now after they cerate a file and save it to the network into a everyone = rwx folder the file does not inherit the proper permissions and no one else can modify the file. Any suggestions would be greatly appreciated.



[ Reply to This | # ]
Setting the Finder's default file mask
Authored by: ecogeek on Jun 02, '03 04:36:08PM

Anyone else run into problems with this? Is it only when you set the umask to be too restrictive that you create problems? Would relaxing the restrictions (i.e. changing the umask to 002) create any system-related troubles?



[ Reply to This | # ]
Setting the Finder's default file mask
Authored by: robleach on Jul 17, '06 10:47:29AM

I work with scripts and command line executables a lot and my boss wants everything set to 775 all the time. The rest of the linux users here seem to set a umask of 002 and all their files end up 775. When I do that, they get set to 664. How can I change my system to give default file permissions of 755? I can't seem to figure it out.

Thanks,
Rob



[ Reply to This | # ]