From: Greg Ercolano <erco@(email surpressed)>
Subject: [SYSADMIN/OSX] Changing the global umask (eg. for the Finder, etc)
   Date: Fri, 23 Sep 2004 08:02:46 -0700
Msg# 711
View Complete Thread (7 articles) | All Threads
Last Next
OSX: HOW TO CHANGE THE GLOBAL UMASK FOR ALL USERS TO 002
--------------------------------------------------------

DESCRIPTION

	The 'umask' is what sets the default read/write
	permissions for files and folders created by users under
	unix.. this includes OSX.

	Under OSX, it's been a strange issue because the
	umask seems to be at a default of 022 (rw-r--r--) for all guis,
	when more often then not, a umask of 002 is desired (rw-rw-r--).

	A umask of 002 allows users in the same group to overwrite
	each other's files, so that eg. renders can be handed off
	from one person to another, without getting permission errors
	when re-writing out image files.

PROBLEM
	Adding a 'umask 002' to the user's ~/.cshrc or ~/.profile
	does nothing, as those files are not referenced by the GUI
	environment (eg. the Finder, or any programs invoked from
	desktop shortcuts or finder).

	Only terminal windows (which invoke csh/tcsh/bash shells)
	reference these files.

	So the question is, where can you put a umask setting
	so that it affects the users?


SOLUTION
	1) Edit the file /Library/Preferences/.GlobalPreferences.plist

	2) Add the lines:
		<key>NSUmask</key>
		<integer>2</integer>

(thanks to the Daniel Flynn at World Wrestling Entertainment)

   From: Greg Ercolano <erco@(email surpressed)>
Subject: Re: [SYSADMIN/OSX] Changing the global umask (eg. for the Finder,
   Date: Fri, 23 Sep 2004 08:20:59 -0700
Msg# 712
View Complete Thread (7 articles) | All Threads
Last Next
SOLUTION
    1) Edit the file /Library/Preferences/.GlobalPreferences.plist

    2) Add the lines:
        <key>NSUmask</key>
        <integer>2</integer>

I should add there's more specific info here:
http://www.macosxhints.com/article.php?story=20031211073631814

Basically you insert the setting below the first <dict> line
in the .GlobalPreferences.plist file, eg:

--------------------------------------------- snip
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
<dict>
<key>NSUmask</key>                                 <--- ADD THIS LINE
<integer>0</integer>                               <--- ADD THIS LINE
[..]
--------------------------------------------- snip

(Obviously, don't include the '<--- ADD THIS LINE' markers)

In addition to changing the global settings for all users
via the /Library/Preferences/.GlobalPreferences.plist,
you can also change the setting on a per-user basis
by changing the file of the same name in the user's
home directory, specifically:

	~<username>/Library/Preferences/.GlobalPreferences.plist

So for instance, to change the user 'fred's file, edit:

	/Users/fred/Library/Preferences/.GlobalPreferences.plist

   From: James J <james.jan@(email surpressed)>
Subject: Re: [SYSADMIN/OSX] Changing the global umask (eg. for the Finder,
   Date: Fri, 23 Sep 2004 09:59:24 -0700
Msg# 714
View Complete Thread (7 articles) | All Threads
Last Next
Is there a global .cshrc?

On Sep 23, 2004, at 8:20 AM, Greg Ercolano wrote:

[posted to rush.general]

SOLUTION
    1) Edit the file /Library/Preferences/.GlobalPreferences.plist
    2) Add the lines:
        <key>NSUmask</key>
        <integer>2</integer>

I should add there's more specific info here:
http://www.macosxhints.com/article.php?story=20031211073631814

Basically you insert the setting below the first <dict> line
in the .GlobalPreferences.plist file, eg:

--------------------------------------------- snip
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
<dict>
<key>NSUmask</key>                                 <--- ADD THIS LINE
<integer>0</integer>                               <--- ADD THIS LINE
[..]
--------------------------------------------- snip

(Obviously, don't include the '<--- ADD THIS LINE' markers)

In addition to changing the global settings for all users
via the /Library/Preferences/.GlobalPreferences.plist,
you can also change the setting on a per-user basis
by changing the file of the same name in the user's
home directory, specifically:

	~<username>/Library/Preferences/.GlobalPreferences.plist

So for instance, to change the user 'fred's file, edit:

	/Users/fred/Library/Preferences/.GlobalPreferences.plist


   From: Greg Ercolano <erco@(email surpressed)>
Subject: Re: [SYSADMIN/OSX] Changing the global umask (eg. for the Finder,
   Date: Fri, 23 Sep 2004 12:45:11 -0700
Msg# 715
View Complete Thread (7 articles) | All Threads
Last Next
James J wrote:
Is there a global .cshrc?

        Yes; in short:

OSX + LINUX:

    /etc/csh.cshrc   -- csh/tcsh loads whenever a csh/tcsh is created
                        (unless -f is specified, eg. '#!/bin/csh -f')

    /etc/csh.login   -- csh/tcsh loads this at login only (eg. 'tcsh -')

    /etc/profile     -- sh/bash loads this at login only (eg. 'sh -l')

        Because most OS's use the public domain shells now, which
        have more or less standardized themselves (tcsh, bash, etc),
        OSX and linux agree on the location of the global rc files.

        In some cases one or both of those files may not exist, but
        you can create them. Just be sure they're 'chown root:root'
        and are 'chmod 644' (rw-r--r--) to prevent user hackery.

        So if you want to add some 3rd party software to everyone's
        login shells, tweak the:

/etc/csh.login
/etc/profile

        ..files.

        If you want settings to also be seen by 'rsh host command',
        then tweak the /etc/csh.cshrc file instead of /etc/csh.login.

        Under IRIX 6.2, the files to modify were /etc/cshrc and /etc/profile.
        Not sure what it is with IRIX 6.5.x (Bill, I'll bet you know)

        When setting environment variables, remember the difference in
        syntax between sh/bash and csh/tcsh, namely:

                csh/tcsh:    setenv NAME "setting"
                sh/bash:     export NAME="setting"

        Note; older sh's may not support the 'export NAME="setting"'
        syntax.. eg. IRIX 6.2. On those older systems, you would need
        the slightly clunkier syntax of 'NAME="setting"; export NAME'

CAVEATS
-------
        Just so you know, wrt OSX, anything you put in the cshrc/profile
        will NOT affect the GUIs like the Finder and Desktop, which is
        the  topic of this thread.

        The cshrc/profile files only affect shell logins, such as
        terminal windows, or rsh/ssh/telnet sessions.

        I'm ignoring the /etc/profile.d/* stuff (linux) for bash,
        but some folks may find that useful, because it lets you
        make a separate file for your settings, instead of needing
        to insert them into the flat /etc/profile.

        HTH.

--
Greg Ercolano, erco@(email surpressed)
Rush Render Queue, http://seriss.com/rush/
Tel: (Tel# suppressed)
Cel: (Tel# suppressed)
Fax: (Tel# suppressed)

   From: Greg Ercolano <erco@(email surpressed)>
Subject: Re: [SYSADMIN/OSX] Changing the global umask (eg. for the Finder,
   Date: Tue, 18 Apr 2006 18:23:48 -0400
Msg# 1273
View Complete Thread (7 articles) | All Threads
Last Next
Greg Ercolano wrote:
OSX: HOW TO CHANGE THE GLOBAL UMASK FOR ALL USERS TO 002
--------------------------------------------------------

DESCRIPTION
    The 'umask' is what sets the default read/write
    permissions for files and folders created by users under
    unix.. this includes OSX.

    Under OSX, it's been a strange issue because the
    umask seems to be at a default of 022 (rw-r--r--) for all guis,
[..]

SOLUTION
    1) Edit the file /Library/Preferences/.GlobalPreferences.plist

    2) Add the lines:
        <key>NSUmask</key>
        <integer>2</integer>

10.4.x UPDATE
-------------

        Following up to this thread on how to adjust the global umask
        on a Mac OSX machine.

	It would appear in 10.4 they started making binary versions of the
	XML files, and in some cases I've seen the umask value already set
	inside the file.

        So to set the global umask in 10.4.x, use these steps:

                1) Edit the /Library/Preferences/.GlobalPreferences.plist file.
                   If it's in binary format, quit the editor without saving,
                   then run this:

                            plutil -convert xml1 /Library/Preferences/.GlobalPreferences.plist

                   ..that will convert the file into an ascii file. (You might want to
                   save the old file, just in case). See 'man plutil' for more info.

                2) Search for an existing "NSUmask" and change the <string>002</string>
                   value to <string>000</string>, eg:

                   BEFORE:
                                <key>NSUmask</key>
                                <string>002</string>

                   AFTER:
                                <key>NSUmask</key>
                                <string>000</string>

                   If the above two lines don't already exist, add them within the outer <dict>
                   section of the file.

	This should affect all users on the machine that change is made to.

	You may also want to check if the user's own .GlobalPreferences.plist file
	in their home directory (eg. /Users/fred/Library/Preferences/.GlobalPreferences.plist)
	doesn't have any settings that might override this value.

   From: Mathieu Xavier Mauser <mathieuxaviermauser@(email surpressed)>
Subject: Re: [SYSADMIN/OSX] Changing the global umask (eg. for the Finder,etc)
   Date: Tue, 06 Jun 2006 14:27:09 -0400
Msg# 1310
View Complete Thread (7 articles) | All Threads
Last Next
On 2006-04-18 15:23:48 -0700, Greg Ercolano <erco@(email surpressed)> said:

Greg Ercolano wrote:
OSX: HOW TO CHANGE THE GLOBAL UMASK FOR ALL USERS TO 002
--------------------------------------------------------

Hi

This is what works for my set up.

1. For group read-write perms, in the Finder. Use Terminal to set globally (all users/same box):

sudo defaults write /Library/Preferences/.GlobalPreferences NSUmask 2

2. And, in Terminal, to set this for apps launched from the Bash shell:

Put "umask 002" in /etc/profile (with no quotation marks)

:)

Mat X


   From: Greg Ercolano <erco@(email surpressed)>
Subject: Re: [SYSADMIN/OSX] Changing the global umask (eg. for the Finder,etc)
   Date: Thu, 03 Sep 2009 14:59:13 -0400
Msg# 1884
View Complete Thread (7 articles) | All Threads
Last Next
The 'defaults write' method is probably a good one.

If you like editing files by hand or by script, here's a macosxhints
article that covers a difference in Leopard:
http://www.macosxhints.com/article.php?story=20071207091554360

Quoting the relevant bits of the article, in case the link goes stale:

   "Setting NSUmask in Leopard is done differently than in previous
    OS X releases (older hints on NSUmask). In 10.5, NSUmask is gone.
    To set a default umask (for both shell and GUI apps), edit
    /etc/launchd.conf and add this line:

	umask 077

    ..where 077 is the new default umask. If nothing is there, the default
    is 022. Note, the /etc/launchd.conf file umask "trick" should work in
    Tiger too, but I didn't test it."

Most of you will probably want 'umask 0' for wide open perms (rw-rw-rw-)
or maybe 'umask 2' for wide open perms to just the user + group,
and read only for 'other' (rw-rw--r)


Mathieu Xavier Mauser wrote:
> On 2006-04-18 15:23:48 -0700, Greg Ercolano <erco@(email surpressed)> said:
> 
>> Greg Ercolano wrote:
>>> OSX: HOW TO CHANGE THE GLOBAL UMASK FOR ALL USERS TO 002
>>> --------------------------------------------------------
> 
> Hi
> 
> This is what works for my set up.
> 
> 1. For group read-write perms, in the Finder.  Use Terminal to set 
> globally (all users/same box):
> 
> sudo defaults write /Library/Preferences/.GlobalPreferences NSUmask 2
> 
> 2. And, in Terminal, to set this for apps launched from the Bash shell:
> 
> Put "umask 002" in /etc/profile (with no quotation marks)