Courseiva
System SecuritymediumMultiple ChoiceObjective-mapped

LPIC-2 System Security Practice Question

A user needs to run a specific command as root without being prompted for a password. The command is /usr/bin/systemctl restart apache2. Which sudoers rule accomplishes this securely?

⚠ Common exam trap

LPIC-2 often tests the subtle syntax requirement that the NOPASSWD tag must be placed immediately before the command list without an extra colon, and candidates mistakenly add a double colon or omit the tag entirely.

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 ALL=(root) NOPASSWD: /usr/bin/systemctl restart apache2

It uses the NOPASSWD tag before the command specification, allowing the user to execute /usr/bin/systemctl restart apache2 as root without a password prompt. The syntax 'user ALL=(root) NOPASSWD: /usr/bin/systemctl restart apache2' is the proper sudoers format, where the tag applies to the following command list. This grants minimal privilege by restricting the user to only that specific command and arguments.

Answer analysis

Option-by-option breakdown

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

  • user ALL=(root) /usr/bin/systemctl restart apache2

    Why it's wrong here

    This requires a password; NOPASSWD is missing.

  • user ALL=(root) NOPASSWD: ALL

    Why it's wrong here

    This allows all commands without a password, which is not secure.

  • user ALL=(root) NOPASSWD:: /usr/bin/systemctl restart apache2

    Why it's wrong here

    Double colon is a syntax error in sudoers.

  • user ALL=(root) NOPASSWD: /usr/bin/systemctl restart apache2

    Why this is correct

    The NOPASSWD tag allows running the specific command without a password.

About these practice questions

This LPIC-2 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 LPIC-2 practice question is part of Courseiva's free LPI 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 LPIC-2 exam.