Install umask on OS X Yosemite

I would like to change my umask on my Mac. Before Yosemite, I used a file /etc/launchd-user.confand just added a command umask 0077.

The goal is to get the correct permissions for files when saving a file in any GUI program, for example. Finder, Notes, and Firefox. To add umask to /etc/profileor ~/.profile, do not solve the problem.

In Yosemite files /etc/launchd.confand /etc/launchd-user.confare no longer fulfilled. man launchctlHe speaks:

The file / etc / launchd.conf is no longer requested for subcommands to run at an early boot time; this functionality has been removed for security reasons.

I tried another example using LaunchAgents. Which I can set environment variables (for example, ENVIRONMENT_RC), but umask is never set.

/ etc. / environment

#!/bin/sh

umask 0077

launchctl setenv ENVIRONMENT_RC "yes"     # Debugging

/Library/LaunchAgents/environment.user.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>environment.user</string>
    <key>ProgramArguments</key>
    <array>
            <string>/bin/sh</string>
            <string>/etc/environment</string>
    </array>
    <key>KeepAlive</key>
    <false/>
    <key>RunAtLoad</key>
    <true/>
    <key>WatchPaths</key>
    <array>
        <string>/etc/environment</string>
    </array>
</dict>
</plist>

Any ideas on installing umask on OS X Yosemite?

Thanks
Reto

+4
source share
2 answers

There is a final solution in OS X Yosemite 10.10.3:

instead of using / etc / launchctl -user.conf: launchctl config user umask 002 (umask example to set 775 permissions)

instead of the system scale /etc/launchctl.conf use: launchctl config system umask 002 (umask example to set 775 permissions)

Apple "Yosemite umask problem" (8 2015 .) : https://support.apple.com/en-us/HT201684

+7

, . . Apple . , umask OS X. !

umask launchctl , "Umask" .plist (, /System/Library/LaunchDaemons/com.apple.configd.plist ):

...
<plist version="1.0">
<dict>
...
    <key>Umask</key>
    <integer>18</integer>
</dict>
</plist>

, LaunchAgent, .

...

,

0

Source: https://habr.com/ru/post/1570767/


All Articles