I am attempting to conceptualize how to go about solving this task. First, here is the task in full.

RHCSA7: Task of the day
Allowed time: 10 minutes.
Create two new user accounts "steve" and "oliver".
Create a group "team". Create a directory "shared".
All files put into the "shared" directory by "steve" or "oliver" should belong 
to the "team" group and be only visible by them.

I know how to create the new users, folder, and group. From what im reading, it sounds like the group should have two members, Steve and Oliver. I would also give the shared directory ownership by root and assign it to the group of team. But, what im really having trouble understanding is how to approach the last line in the task:

All files put into the "shared" directory by "Steve" or "Oliver" should belong to the "team" group and be only visible by them.

What immediately comes to mind is that I should use the Set GID option with chmod. Because I have added Steve and Oliver to the group team, I could use the following command

chmod g+s shared

Since i assigned the shared directory to the group team this would assign all new files and directory's added to the shared directory to the same group, team.

Is this the correct approach, or a working solution to this task?

As a tidbit, the portion that reads should only be visible by them ... should i read this as only having read access? If this was the case, then no new files or directories would be added unless they are added by the root user.

  • 1
    It sounds like you are reaching a sufficient level of complexity of permissions that it's time to learn about ACLs. – Wildcard Apr 2 '16 at 4:37
  • @Wildcard I dont think this should be counted as a duplicate. The original question is asking what the solution is to the problem whereas I am asking if my solution is the correct approach. The problem may be the same, the question however is different. What is the answer vs is my answer correct. – Oscalation Apr 2 '16 at 19:19

Your proposed solution is correct.

I would interpret the part about the shared directory only being visible to members of the group "team" to mean that others cannot read the files in that directory. NOT that the members of the team group do not have write access.

Not the answer you're looking for? Browse other questions tagged or ask your own question.