Question 87 of 510
SecuritymediumMultiple SelectObjective-mapped

Quick Answer

The answer is `chage -M 60 -W 7 username` and `passwd -x 60 -w 7 username`. Both commands directly enforce the security policy by setting the maximum password age to 60 days and the warning period to 7 days before expiration, with `-M` and `-x` controlling the expiration interval and `-W` and `-w` controlling the advance warning. On the CompTIA Linux+ XK0-005 exam, this tests your ability to manage password aging policies using system utilities, often appearing as a scenario where you must select the correct flags for `chage` or `passwd` to meet a compliance requirement. A common trap is confusing `-M` (maximum days) with `-m` (minimum days) or forgetting that `passwd` uses lowercase `-x` and `-w` while `chage` uses uppercase. To remember, think of `chage` as “change age” with capital flags for the major policy settings, and `passwd` as the lower-level tool with the same logic but different letter cases.

XK0-005 Security Practice Question

This XK0-005 practice question tests your understanding of security. Match the stated requirement to the specific cloud service, access model, or configuration option — many options are valid in isolation but not for this scenario. 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 security policy requires that user passwords must expire every 60 days and users should be warned 7 days before expiration. Which two commands can be used to set these policies? (Select TWO).

Question 1mediummulti select
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

passwd -x 60 -w 7 username

Option A is correct because the `passwd -x 60 -w 7 username` command sets the maximum password age to 60 days (`-x`) and the warning period to 7 days before expiration (`-w`). This directly satisfies the policy requirements for password expiration and advance warning.

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.

  • passwd -x 60 -w 7 username

    Why this is correct

    Correct: passwd also sets max days and warning.

    Related concept

    Read the scenario before looking for a memorised answer.

  • chage -E 60 -W 7 username

    Why it's wrong here

    chage -E sets account expiration date, not password max days.

  • usermod -e 60 -f 7 username

    Why it's wrong here

    This sets account expiry date and inactivity, not password expiration.

  • chage -M 60 -W 7 username

    Why this is correct

    Correct: chage sets password expiration and warning.

    Related concept

    Read the scenario before looking for a memorised answer.

  • passwd -n 60 -m 7 username

    Why it's wrong here

    This sets minimum days and, -m is not the correct option for warning.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is confusing the `chage` flags: candidates often mistake `-E` (account expiration) for password maximum age, or mix up `passwd` options like `-n` (minimum days) with `-x` (maximum days), leading them to select options that set the wrong parameters.

Detailed technical explanation

How to think about this question

The `chage` command is the primary tool for managing password aging on Linux, with `-M` setting the maximum number of days a password is valid and `-W` setting the number of days before expiration to issue a warning. The `passwd` command's `-x` and `-w` options achieve the same effect but are less commonly used; both modify the same underlying `/etc/shadow` fields (e.g., `chage -M 60 -W 7` sets the 5th and 6th fields). In real-world scenarios, administrators often use `chage` for bulk scripting because it provides more granular control, such as `-m` for minimum age and `-I` for inactivity lockout.

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 practitioner preparing for the XK0-005 exam encounters this exact type of scenario on the job. The correct answer here is not the most general option — it is the best answer for the specific constraint described. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Real exam questions reward reading the full scenario before eliminating options, because the constraint defines which answer fits.

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 XK0-005 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 XK0-005 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 XK0-005 question test?

Security — This question tests Security — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: passwd -x 60 -w 7 username — Option A is correct because the `passwd -x 60 -w 7 username` command sets the maximum password age to 60 days (`-x`) and the warning period to 7 days before expiration (`-w`). This directly satisfies the policy requirements for password expiration and advance warning.

What should I do if I get this XK0-005 question wrong?

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

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 XK0-005

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 policy requires that user passwords must expire every 90 days. Which command can enforce this policy for user 'jsmith'?

medium
  • A.usermod -e 90 jsmith
  • B.chage -M 90 jsmith
  • C.passwd -x 90 jsmith
  • D.chfn -f 90 jsmith

Why B: The `chage -M 90 jsmith` command sets the maximum number of days a password is valid for user 'jsmith' to 90, which enforces the 90-day expiration policy. The `-M` option directly modifies the `PASS_MAX_DAYS` field in `/etc/shadow`, and `chage` is the standard tool for managing password aging on Linux systems.

Variation 2. A security policy requires that user passwords must expire after 90 days. The output in the exhibit shows the current configuration for the root user. Which command should the administrator run to enforce the policy for root?

hard
  • A.sudo passwd -x 90 root
  • B.sudo chage -M 90 root
  • C.sudo chage -E 90 root
  • D.sudo usermod -e 90 root

Why B: The `chage -M 90 root` command sets the maximum number of days a password is valid for the root user to 90 days, which directly enforces the password expiration policy. The `-M` option modifies the `max_days` field in `/etc/shadow`, causing the password to expire after the specified period. This is the correct method to apply aging rules to the root account.

Last reviewed: Jun 25, 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 XK0-005 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 XK0-005 exam.