But it seems I need to get root access to write data to
/Library/Application Support/YourApp
... right?
Yes. Here’s the default permissions for the
/Library/Application Support/
directory:
$ ls -ld '/Library/Application Support/'
drwxr-xr-x 11 root admin 352 28 Sep 05:41 /Library/Application Support/
As you can see, only
root
can write to it.
Can I write to
/Users/Shared/
, Does this required root privileges?
No. Here’s the default permissions for
/Users/Shared/
:
$ ls -ld /Users/Shared/
drwxrwxrwt 4 root wheel 128 28 Sep 05:30 /Users/Shared/
This shows that anyone can write to the directory. It’s also marked as sticky.
Is there anything wrong in doing this?
Very likely. It really depends on what you’re writing there. The fact that any process on the system can modify this directory makes it a breeding ground for security vulnerabilities. The fact that it’s sticky helps mitigate those somewhat, but it’s still something you’d have to approach with extreme caution.
What are you planning to store there?
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"