MacOS File Permissions Reset After Writing

filesystemgroupmacospermission

I have two user accounts on my MacOS 10.12, both should be able to read and write a KeePass file saved in /Users/Shared/. I've created a user group for this called me that contains both users. In the options/info dialog of that file I added read&write permission for that group. Now both users can read it and even write to it ……. once. After the file has been written, the file permissions reset so that the other user account can't read nor write. This is very annoying.

Can I fix this somehow?

Best Answer

What you need is to change the permissions of the folder containing the file. Better to use the Terminal for that.

First, set the group of the folder to me (the same group as your two users)

chown :me /Users/Shared

Second, set the SetGID bit of the folder

chmod g+s /Users/Shared

Now, when KeyPass will modify the database, it will stick with the group you defined on your folder.

As a bonus, any new file in the Shared folder will automatically belong to that same group.