LFCS Essential Commands Practice Question
A security policy requires that all users in the 'webadmin' group should have read and write access to files in /var/www/html. New files created in that directory should automatically be assigned to the 'webadmin' group and have group read/write permissions. Which combination of permissions and group ownership should be set on /var/www/html?
⚠ Common exam trap
A common mix-up: candidates confuse the setgid bit (g+s) with the sticky bit (o+t) or setuid bit (u+s), and may overlook that the numeric mode must include the leading 2 (or 2xxx) to enable setgid, not just the symbolic chmod g+s.
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
✓
chmod g+s /var/www/html; chmod 2775 /var/www/html; chown root:webadmin /var/www/html
Setting the setgid bit (g+s) on /var/www/html ensures that new files inherit the directory's group ('webadmin'), and the 2775 permissions grant group read/write/execute (rwx) while the setgid bit is represented by the leading 2. This combination satisfies the security policy: group ownership inheritance and group read/write access for all new files.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
chmod o+t /var/www/html; chmod 1775 /var/www/html; chown root:webadmin /var/www/html
Why it's wrong here
Sticky bit is for restricting deletion, not group inheritance.
- ✗
chmod g+s /var/www/html; chmod 2755 /var/www/html; chown root:webadmin /var/www/html
Why it's wrong here
Only read/execute for group, not write.
- ✗
chmod u+s /var/www/html; chown root:webadmin /var/www/html
Why it's wrong here
Setuid doesn't affect group inheritance.
- ✓
chmod g+s /var/www/html; chmod 2775 /var/www/html; chown root:webadmin /var/www/html
Why this is correct
Setgid bit ensures new files inherit group, and permissions allow group write.
Go deeper
Related to this question
About these practice questions
This LFCS question is part of Courseiva's 507-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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.