Question 24 of 510
Application Environment, Configuration and SecuritymediumMultiple ChoiceObjective-mapped

Quick Answer

The answer is to run the container with a non-root user and drop all capabilities, as this directly enforces the principle of least privilege in container runtime security. By default, even a non-root container process retains a set of Linux capabilities that can be abused for privilege escalation, so explicitly dropping all capabilities removes those risks entirely while the non-root user prevents direct root-level access to the host. On the CompTIA SecurityX CAS-004 exam, this concept tests your understanding of container runtime security best practices within the broader domain of secure software deployment and virtualization; a common trap is assuming that simply using a non-root user is sufficient, when in fact capabilities must also be stripped to achieve true least privilege. Remember the memory tip: “Drop caps, drop root—no privilege to loot.”

CAS-004 Least privilege in containers Practice Question

This CAS-004 practice question tests your understanding of application environment, configuration and security. The scenario asks you to isolate a root cause — eliminate options that address a different problem before choosing. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

A company is deploying a web application in a containerized environment. The security team wants to ensure that the application runs with the least privilege necessary. Which of the following is the BEST approach to achieve this?

Clue words in this question

Noticing these words before you look at the options changes how you read each choice.

  • Clue: "best"

    Why it matters: Signals that multiple options may be partially correct. Choose the option that most directly solves the exact problem described, not the one that sounds most complete.

  • Clue: "least"

    Why it matters: You want the option with minimum overhead, fewest steps, or lowest impact — not the most feature-rich or comprehensive answer.

Question 1mediummultiple choice
Full question →

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

Run the container with a non-root user and drop all capabilities

Option B is correct because running a container with a non-root user and dropping all capabilities enforces the principle of least privilege. By default, containers run with a limited set of capabilities, but explicitly dropping all capabilities and using a non-root user ensures that even if the application is compromised, an attacker cannot escalate privileges or perform privileged operations. This aligns with container security best practices, such as those outlined in the Docker security documentation and the CIS Docker Benchmark.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

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

  • Run the container as root and use a restrictive seccomp profile

    Why it's wrong here

    Running as root still gives elevated privileges; seccomp alone does not enforce user-level least privilege.

  • Run the container as root but use a read-only filesystem

    Why it's wrong here

    Read-only filesystem does not prevent root-level process attacks; the container still runs as root.

  • Run the container with the --privileged flag and a custom AppArmor profile

    Why it's wrong here

    --privileged gives the container nearly all host capabilities, violating least privilege.

Option-by-option analysis

Why each answer is right or wrong

Understanding why wrong answers are wrong — and when they would be correct — is what separates a 750 score from a 900. The CAS-004 exam frequently reuses these exact scenarios with slightly different constraints.

Run the container with a non-root user and drop all capabilitiesCorrect answer
Run the container as root and use a restrictive seccomp profileWrong answer — click to see why

Why this is wrong here

Running as root still gives elevated privileges; seccomp alone does not enforce user-level least privilege.

Run the container as root but use a read-only filesystemWrong answer — click to see why

Why this is wrong here

Read-only filesystem does not prevent root-level process attacks; the container still runs as root.

Run the container with the --privileged flag and a custom AppArmor profileWrong answer — click to see why

Why this is wrong here

--privileged gives the container nearly all host capabilities, violating least privilege.

Analysis generated from the official CAS-004blueprint and verified against question context. The “when correct” sections are what AI assistants cite when candidates ask “what’s the difference between these options?”

Common exam traps

Common exam trap: answer the scenario, not the keyword

Cisco often tests the misconception that root in a container is safe because of namespace isolation, but the trap here is that root inside a container still has dangerous capabilities that can be exploited if the container is compromised, so the best approach is to avoid root entirely and drop all capabilities.

Detailed technical explanation

How to think about this question

Under the hood, Linux capabilities are unit divisions of the root user's privileges; dropping all capabilities (e.g., via `--cap-drop=ALL` in Docker) removes even common capabilities like CAP_NET_BIND_SERVICE, which may require explicit re-addition if the application needs to bind to a low port. In practice, a non-root user inside a container is mapped to a high UID (e.g., 65534) and combined with a user namespace remapping can further isolate the container from the host. A real-world scenario is a web server like Nginx: running it as a non-root user with dropped capabilities prevents an attacker from using a compromised process to load kernel modules or change system time.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A junior network technician can log in to a core router but cannot reach the enable prompt or configuration mode. The AAA server is authenticating the login — but the authorisation policy only grants privilege level 1, not 15. Authentication (who you are) is working; authorisation (what you can do) is not.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related CAS-004 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free CAS-004 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this CAS-004 question test?

Application Environment, Configuration and Security — This question tests Application Environment, Configuration and Security — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Run the container with a non-root user and drop all capabilities — Option B is correct because running a container with a non-root user and dropping all capabilities enforces the principle of least privilege. By default, containers run with a limited set of capabilities, but explicitly dropping all capabilities and using a non-root user ensures that even if the application is compromised, an attacker cannot escalate privileges or perform privileged operations. This aligns with container security best practices, such as those outlined in the Docker security documentation and the CIS Docker Benchmark.

What should I do if I get this CAS-004 question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Are there clue words in this question I should notice?

Yes — watch for: "best", "least". Signals that multiple options may be partially correct. Choose the option that most directly solves the exact problem described, not the one that sounds most complete.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

2 more ways this is tested on CAS-004

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. A security assessor is reviewing a containerized application. Which three of the following practices help secure the container runtime environment? (Select the three best options.)

hard
  • A.Run the container with a read-only root filesystem
  • B.Use the latest base image from Docker Hub
  • C.Drop all Linux capabilities and add only required ones
  • D.Run the container process as a non-root user

Why A: Running a container with a read-only root filesystem (option A) prevents any writes to the container's filesystem layer, which blocks malware from dropping files, modifying binaries, or persisting changes. This is enforced by the container runtime (e.g., Docker, containerd) by mounting the root filesystem as read-only, typically using the `--read-only` flag. Even if an attacker gains code execution inside the container, they cannot alter system files or install tools, significantly reducing the blast radius of a compromise.

Variation 2. During a security review, a developer discovers that a containerized application runs with root privileges. Which of the following is the most secure approach to mitigate this risk while maintaining functionality?

hard
  • A.Set the container to run as a non-root user and drop all unnecessary capabilities
  • B.Disable root login inside the container by modifying /etc/passwd
  • C.Use a read-only root filesystem for the container
  • D.Enable SELinux or AppArmor on the host

Why A: Running a container as a non-root user with dropped capabilities is the most secure approach because it follows the principle of least privilege. By default, containers run as root, which grants unnecessary kernel capabilities that could be exploited for privilege escalation. Setting a non-root user and using `--cap-drop=ALL` with selective `--cap-add` ensures the application retains only required permissions, reducing the attack surface without breaking functionality.

Keep practising

More CAS-004 practice questions

Last reviewed: Jun 11, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This CAS-004 practice question is part of Courseiva's free CompTIA 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 CAS-004 exam.