0

So I have 4 users on my redhat system.

*P- primary group

S- supplementary/secondary group*

UserA - P: Teacher S: USA

UserB - P: Teacher S: School

UserX - P: Student S: School

UserY - p: Student S: School, USA

How do I allow everyone in School/USA secondary groups to have read access to all users' home directories in the group? e.g. UserX should be able to read User B & Y's home directories because they are in the group School. But UserX cannot read UserA's home because UserX is not in USA.

UserY can read everyone's home.

2
  • haven't tried anything because I don't know how to even start!
    – REDBEAN
    Jul 20, 2016 at 12:39
  • This is a very obvious homework (or other coursework) question. The place where you got it from gave you a question without a place to start figuring it out? Hint, read up on file/directory ownership & permissions.
    – phemmer
    Jul 20, 2016 at 12:41

1 Answer 1

2

The best and easiest thing you can do is to add groups to each of your users, i.e. modifying your users! This task can be done by using usermod command. Read more here. Be aware that -g option is for user's new initial group (i.e. Primary) while -G option is a list of supplementary groups which the user can be also a member of. You can get more information by reading usermod's manual page by running man usermod.

For permitting a member of a group to read everything under one's home directory, that home directory should have "read" permission bit on for groups, i.e. if your X home directory is drwx------, you should change it to be drwxr----- by using chmod command. For using permission bits wisely, read about them here. In addition you can read about SUID, SGID, and Sticky bits here. BTW, you should read this article to understand chmod, chown, and chgrp commands.

Let me know if you have any problems.

Good Luck

1
  • 1
    BTW, add -a option with the -G option if you want to append.
    – user172564
    Jul 20, 2016 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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