Using Unix Groups for Group Projects

If you are going to be working in a group for your projects, you might want to be able to share files with your group members. This will allow group members read (and write, if you'd like) access to project files.

Here's what you need to do:

  1. Form your group.
  2. Request the creation of a Unix group for a class project. You'll need to contact Mary Bailey for this. She will need the usernames of your group members.
  3. Once the group has been created, new login sessions for all group members will include group permissions. Try the Unix command groups to see which groups you are in. Your new group should be listed.
  4. Pick a location for your group's work. This will be in a group member's account. Create a directory.
  5. Change the permissions on the directory to permit access to all group members. The following assumes you want to add read/write access for all group members of group 338grp on the directory 338proj.
    1. Change group ownership of the directory: chgrp 338grp 338proj
    2. Permit group read/write/execute: chmod g+rwx 338proj
    3. Set the "setgroupid" bit on the directory. This will force any files and directories you create inside of 338proj to have group ownership 338grp: chmod g+s 338proj
    4. Remove all permissions from non-group members: chmod o-rx 338proj

    All of the chmod steps above can be combined into a single command: chmod 2770 338proj - see chmod(1) for details.

    ls -lg will list your files including group information.

  6. Make sure group members have appropriate permissions on the parent directories that will allow them to cd to the group directory. The requires only world execute permissions, but not read permissions on parent directories. This will allow cd, but not ls.