Courseiva
Essential CommandsmediumMultiple ChoiceObjective-mapped

LFCS Essential Commands Practice Question

A developer wants to change the ownership of a directory and all its contents recursively to user 'appuser' and group 'appgroup'. Which command accomplishes this?

⚠ Common exam trap

The trap here is that candidates often forget the `-R` flag on the second command in compound solutions, or they mistakenly believe `chown user:` sets a specific group rather than the user's default group, leading them to choose options that only partially apply the ownership change.

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

chown -R appuser:appgroup /app

The `chown -R appuser:appgroup /app` command recursively changes both the user and group ownership of the `/app` directory and all its contents. The `-R` flag ensures recursion, and the colon-separated `user:group` syntax sets both ownership attributes in a single command.

Answer analysis

Option-by-option breakdown

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

  • chown -R appuser:appgroup /app

    Why this is correct

    Correct: recursive owner:group change.

  • chown -R appuser /app && chgrp appgroup /app

    Why it's wrong here

    Changes owner recursively, but group only on top directory.

  • chgrp -R appgroup /app && chown appuser /app

    Why it's wrong here

    Only changes group recursively, then owner only on top directory.

  • chown -R appuser: /app && chgrp -R appgroup /app

    Why it's wrong here

    First command changes owner to appuser and group to login group, second changes group recursively, but redundant.

About these practice questions

Courseiva writes every LFCS question from scratch — 507 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 →

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.