User & Group Permissions

Discussion in 'macOS' started by kizersoze, Nov 1, 2008.

  1. kizersoze macrumors newbie

    Oct 31, 2008
    I'm new to the iMac (this week) but have had some experience on *nix all though it's been a while.

    I've been through the man pages for chown and chgrp and can't quite figure out how to accomplish the following, or if it's even possible.

    I'd like to create a directory/folder that users of a specific group have read/write access to but also each user having the access to edit each others files in that directory/folder.

    For example, my wife and I can currently create documents in a folder I created called FamilyDocs, however I can't change any documents that she creates (were both Admins). How can I solve this? Is there a way to do this without setting up a cron job to periodically reset the permissions in a tree?

    Hope this makes sense.

  2. belvdr macrumors 603

    Aug 15, 2005
    If you and your wife have a common group, you can:

    find <directory> -type f -exec chown <common group> {} \;
    find <directory> -type f -exec chmod 660 {} \;
    That'll take care of the files.

    For the directories:

    find <directory> -type d -exec chown <common group> {} \;
    find <directory> -type d -exec chmod 770 {} \;
    That will only allow user in that common group to access either the directories or the files.

    umask is what determines the permissions of files and directories created. If you want your primary group to be different, you'll need to modify the users and specify that.
  3. kizersoze thread starter macrumors newbie

    Oct 31, 2008
    Thanks for the help, however I'm getting an invalid argument on the first chown. Also, going forward for any new created documents by either myself or my wife will we be able to edit those? I found this article and it may explain why I'm seeing permission issues.
  4. kizersoze thread starter macrumors newbie

    Oct 31, 2008
    I got the syntax figured out on the chown so that's not an issue now. Am curious about documents going forward after I apply this.

  5. belvdr macrumors 603

    Aug 15, 2005
    Use chgrp instead of chown. Sorry about that.

    You can run:
    to see what your primary groups are for you and your wife, and also to see what the umask is set to (should be 022, which should be fine, if you and your wife share the same primary group).
  6. kizersoze thread starter macrumors newbie

    Oct 31, 2008
    Both my wife and i are in the "Admin" group. I created a directory called FamStuff and performed the chmod/chown on it.

    Here is the directory.

    drwxrwx--- 3 ******* admin 102 Nov 1 20:35 FamStuff

    Next i went in and created a file under my account by just echoing some txt to a prob...then su'ed to my wifes account and then tried to echo some more txt into it and no go, permission denied.

    Here is the file.

    -rw-r--r-- 1 ******* admin 6 Nov 1 20:35 edtestfile.txt

    So going forward anytime I create a file I will have to explicitly give permission to the group? According to the thread I found I can control the Umask in the terminal, but if I create documents through GUI apps then that umask goes back to the default which is Write only for the User and not group.

    So I guess to keep the permissions on documents going forward I would need to setup a cron job to recursively change the permissions to write for the group?

    Open to suggestions or maybe I'm doing something wrong.
  7. belvdr macrumors 603

    Aug 15, 2005
    On normal Unix systems, the umask is set via /etc/profile and is inherited by all applications. Unfortunately, I do not have a Mac to check, so maybe someone else will have an idea.

Share This Page