Courseiva
Service Configuration →mediumMultiple Choice

LFCS Service Configuration Practice Question

A service is configured to run as a specific user. Which directive in the [Service] section sets the user?

⚠ Common exam trap

A common mix-up: candidates confuse systemd's `User=` with the `RunAs` keyword from other operating systems (like Windows services or Solaris) or with generic terms like `Account`, leading them to pick a plausible-sounding but incorrect option.

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

In systemd service units, the directive to specify the user under which the service process runs is `User=` within the `[Service]` section. This directive sets the Unix user account (by name or UID) that the service's main PID will execute as, ensuring proper privilege separation and security.

Answer analysis

Option-by-option breakdown

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

  • ✗

    RunAs

    Why it's wrong here

    RunAs is not a systemd directive; it echoes Kubernetes securityContext.runAsUser, which is a different platform. It is tempting because it describes the intent precisely, but systemd's [Service] section requires User= to set the account, and unknown keys make the unit fail to load.

  • ✓

    User

    Why this is correct

    The User directive in the [Service] section specifies the UNIX account the service process runs as, directly satisfying the requirement to run the service under a specific user rather than root or the default system account.

  • ✗

    Account

    Why it's wrong here

    Account is not a valid systemd [Service] directive; the correct key is User=. It is tempting because 'account' is a natural synonym for the user a service runs as, but systemd parses only User=, and an unrecognised directive causes the unit to fail to load.

  • ✗

    UserID

    Why it's wrong here

    systemd unit files have no UserID directive; the [Service] section uses User= to set the account. UserID is tempting because it sounds like the numeric UID equivalent, but systemd expects the name or numeric ID directly after User=, and an unrecognised directive causes the unit to fail to load.

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.