0

I'm doing a LAB from a RHCSA book and would like to ask for some help. The task is:

Log on to host1 as root and create directory /shared_dir1. Create a group called shared_grp and assign user1000 and user2000 to it (create these users). Set up appropriate ownership, group membership, and permissions on the directory to support group collaboration.

What I've done so far:

1) created the /shared_dir1 as root

mkdir /shared_dir1

2) create the group shared_grp

groupadd -g 9998 shared_grp

3) created both users

adduser user1000
adduser user2000

4) assigned user1000 and user2000 to the shared_grp

usermode -G shared_grp user1000
usermode -G shared_grp user2000

5) to support group collaboration I've set the setgid bit as follows

chmod g+s /shared_dir1

6)verified that the setgid bit is set properly

ls -ld /shared_dir1

drwxr-**s**r-x 

7) changed group ownership from root to shared_grp:

chown root:shared_grp /shared_dir1

My first question is, why I'm able to cd in to the /shared_dir1 (with user1000 or user2000 when according to the ls command the /shared_dir1 is lacking the execute permission ?

2

The lower-case 's' in the mode string means it is set-gid with executable. That string is a 2755 permissions set. If you remove the group executable bit but leave the setgid, you will see:

drwxr-Sr-x

which would be numerical mode 2745.

  • Thank you@John. I appreciate your help! My book was not mentioning it ;( Just one more question. When they mention permissions and please correct me if I'm wrong but wouldn't I have first to modify the groups permission on this particular directory e.g chmod g+w /shared_dir1 so that they can read, write to files in that directory? If yes, what about preventing from accidental and non accidental file deletion ? Should I also use the sticky bit along with the setgid ?Many thanks! – adam86 Sep 15 '16 at 14:46

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.