Courseiva
User and Group Management →mediumMultiple Choice

LFCS User and Group Management Practice Question

Scenario: You are managing a Linux server that hosts a web application. The application runs under the user 'webapp' and the group 'webgroup'. Recently, a new intern 'john' (username 'john') needs to be able to view and modify files in /var/www/html, which is owned by root:webgroup with permissions 775. John is currently a member of the group 'staff', but not 'webgroup'. The security policy requires that John must be able to edit files without using sudo, and his primary group must remain 'staff'. Which of the following actions should you take to meet the requirements?

⚠ Common exam trap

Many candidates confuse the setgid bit (Option D) with granting group membership, or incorrectly assume that changing the primary group (Option C) is acceptable despite the explicit requirement to keep it as 'staff'.

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

✓

Add John to the 'webgroup' supplementary group with 'usermod -a -G webgroup john'.

Adding John to the 'webgroup' supplementary group with `usermod -a -G webgroup john` grants him group-level access to /var/www/html (owned by root:webgroup with permissions 775) without changing his primary group 'staff'. This allows him to view and modify files as a member of 'webgroup', satisfying the security policy that he must not use sudo and his primary group must remain unchanged.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    Add John to the 'webgroup' supplementary group with 'usermod -a -G webgroup john'.

    Why this is correct

    Adding john to webgroup as a supplementary group grants him the group write permission on /var/www/html (775, root:webgroup) without sudo, while his primary group stays staff. This satisfies both the editing requirement and the policy that his primary group remain unchanged.

  • ✗

    Change the group ownership of /var/www/html to 'staff' and set the setgid bit.

    Why it's wrong here

    Changing group ownership to staff grants access to every staff member, not just John, violating least privilege. Setgid on a staff-owned directory is right for team-shared trees where all staff should have equal write access.

  • ✗

    Change John's primary group to 'webgroup' with 'usermod -g webgroup john'.

    Why it's wrong here

    Setting John's primary group to webgroup directly contradicts the stated requirement that his primary group remain staff. It is tempting because changing a user's primary group does grant group-based file access, and would be valid if the policy allowed altering his primary group rather than adding a supplementary one.

  • ✗

    Set the setgid bit on /var/www/html with 'chmod g+s /var/www/html'.

    Why it's wrong here

    The setgid bit only makes new files inherit the directory's group; it grants John no access, since he is not in webgroup. Setgid suits shared collaborative directories where members already belong to the owning group.

About these practice questions

One of 406 original LFCS practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.