A new file's group is chosen by the process that creates it. A directory can change that rule.
The owner of a new file is the process's user, and its group is the process's primary group. Ubuntu gives every user a personal group with the same name, so alice's primary group is alice. That is how plan.txt got the group alice even though it sat in the devs group's directory. bob is not in the alice group, so the others triple applied to him: r--.
The setgid bit on a directory changes the rule: a new file gets the directory's group. The bit sits in the group's x position as the letter s:
chmod g+s directory sets it. In numeric form it is a 2 in front of the usual three digits: chmod 2775 directory. A subdirectory created inside gets both the directory's group and the bit itself. Files that were already in the directory keep their group: chown :devs file changes it.
Give new files the directory's group
In /srv/team, make new files get the devs group, whoever creates them. Keep the directory's owner, group, and rwxrwxr-x as they are.
Goals · 0 of 1
- Pass the devs group on to new files not done yet