Courseiva
Service ConfigurationeasyMultiple ChoiceObjective-mapped

LFCS Service Configuration Practice Question

An administrator needs to configure a service to run as a non-root user for security reasons. Which systemd unit file directive accomplishes this?

⚠ Common exam trap

Many exam-takers confuse `User=` with `Group=` or assume that `DynamicUser=yes` is the only way to run as a non-root user, missing that `User=` directly specifies a static, named user account.

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

User=myuser

The `User=` directive in a systemd unit file specifies the user (by name or UID) under which the service process runs. By setting `User=myuser`, the service executes with the privileges of that non-root user, reducing the attack surface and adhering to the principle of least privilege. This is the standard systemd mechanism for dropping root privileges for a service.

Answer analysis

Option-by-option breakdown

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

  • AmbientCapabilities=CAP_NET_BIND_SERVICE

    Why it's wrong here

    This grants capabilities, not user identity.

  • DynamicUser=yes

    Why it's wrong here

    DynamicUser= creates a transient user, but the actual user is not 'myuser'.

  • User=myuser

    Why this is correct

    User= specifies the username or UID to run the service.

  • Group=myuser

    Why it's wrong here

    Group= sets the group, but the user must also be specified.

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 →

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.