LFCS User and Group Management Practice Question
A system administrator needs to create a shared group 'projectx' and add existing users 'bob' and 'carol' to it. The users need to collaborate on files in a directory /projectx. What is the correct sequence of commands to set up the group and ensure new files created in /projectx are automatically owned by the group 'projectx'?
⚠ Common exam trap
The trap here is that `usermod -G` without `-a` overwrites the user's supplementary groups, and candidates often forget the `-a` flag, leading to accidental removal of existing group memberships.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
groupadd projectx; usermod -aG projectx bob; usermod -aG projectx carol; chmod g+s /projectx
It uses `groupadd` to create the group, `usermod -aG` to append users to the group without removing them from other groups, and `chmod g+s` to set the setgid bit on the directory. The setgid bit ensures that new files created in /projectx inherit the group ownership of the directory (projectx), enabling collaboration.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
groupadd projectx; usermod -G projectx bob carol; chmod 2770 /projectx
Why it's wrong here
usermod accepts one user per invocation, so 'usermod -G projectx bob carol' treats carol as an extra argument and fails, leaving carol outside projectx; the 2770 mode and setgid bit are otherwise correct. Tempting because chmod 2770 does combine setgid with group write access, which is the right directory configuration.
- ✗
addgroup projectx; adduser bob projectx; adduser carol projectx; chmod u+s /projectx
Why it's wrong here
chmod u+s sets the setuid bit, which changes execution privileges, not group inheritance; new files would take the creator's primary group. It is tempting because it is a permission-related command, and it would be correct for running an executable with the file owner's privileges, not for forcing group ownership in a shared directory.
- ✓
groupadd projectx; usermod -aG projectx bob; usermod -aG projectx carol; chmod g+s /projectx
Why this is correct
groupadd creates the group, usermod -aG appends bob and carol as supplementary members without disturbing their primary groups, and chmod g+s sets the setgid bit on /projectx so new files inherit the projectx group rather than each creator's primary group.
- ✗
groupadd projectx; usermod -G projectx bob; usermod -G projectx carol; chmod g+s /projectx
Why it's wrong here
The setgid bit alone does not guarantee group ownership: without 2770 permissions, other users can still traverse or write, and usermod -G adds only a supplementary group, so bob and carol keep their primary group on new files unless the directory's group is inherited via setgid plus restrictive mode. Tempting because setgid is the mechanism for group inheritance.
Go deeper
Related to this question
About these practice questions
Courseiva writes every LFCS question from scratch — 406 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This LFCS practice question is part of Courseiva's free Linux Foundation certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LFCS exam.