Question 342 of 527
Manage securityeasyMultiple ChoiceObjective-mapped

Quick Answer

The answer is `usermod -s /sbin/nologin apache`. This command works by changing the user’s login shell to `/sbin/nologin`, a special program that prints a polite message and immediately exits, preventing the user from obtaining any interactive shell via SSH or console login. The key technical concept is that the system executes the user’s configured shell at login; by setting it to `/sbin/nologin`, you deny shell access while leaving the apache user’s other services—like the web server—fully functional. On the Red Hat Certified System Administrator EX200 exam, this tests your understanding of user account security and the `/etc/passwd` shell field. A common trap is confusing `nologin` with locking the account via `usermod -L`, which only disables password-based login but still allows SSH key authentication; `nologin` blocks all interactive logins regardless of method. Remember the mnemonic: “No shell, no login—nologin is the shell that tells them to go away.”

EX200 Manage security Practice Question

This EX200 practice question tests your understanding of manage 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 junior admin needs to ensure that the 'apache' user (UID 48) cannot log in via SSH or console. Which command achieves this?

Clue words in this question

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

  • Clue: "which command"

    Why it matters: Tests specific CLI syntax. Recall the exact command and its required context — near-synonyms and partial matches are common distractors.

Question 1easymultiple 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

usermod -s /sbin/nologin apache

Option A is correct because setting the user's login shell to `/sbin/nologin` prevents the user from obtaining an interactive shell via SSH or console login. When the user attempts to log in, the system executes `/sbin/nologin`, which prints a polite message and exits immediately, effectively denying shell access while leaving other services (e.g., Apache) functional.

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.

  • usermod -s /sbin/nologin apache

    Why this is correct

    Sets shell to nologin, blocking interactive login.

    Clue confirmation

    The clue word "which command" in the question point toward this answer.

    Related concept

    Read the scenario before looking for a memorised answer.

  • passwd -l apache

    Why it's wrong here

    Locks password but doesn't prevent SSH key login.

  • chage -l apache

    Why it's wrong here

    Lists password expiry; does not restrict login.

  • usermod -e 1 apache

    Why it's wrong here

    Sets account expiration; doesn't prevent immediate login.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates often confuse password locking (`passwd -l`) with shell restriction, not realizing that SSH key authentication or console login via `su` bypasses password locks, while changing the shell to `/sbin/nologin` blocks all interactive login methods.

Detailed technical explanation

How to think about this question

The `/sbin/nologin` shell is a standard system shell that simply exits with a non-zero status after printing a configurable message (defined in `/etc/nologin.txt` if present). Unlike locking the password or expiring the account, changing the shell preserves the user's ability to run processes via systemd, cron, or other non-interactive mechanisms. This is critical for service accounts like `apache` that must remain functional for the web server but should not allow interactive shell access.

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 security administrator must allow nursing staff to reach a patient records server while blocking access from the guest Wi-Fi VLAN. After applying an extended ACL, traffic is still blocked from nursing workstations. The ACL was applied outbound instead of inbound on the wrong interface. Questions like this test ACL direction and placement rules.

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 EX200 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 EX200 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 EX200 question test?

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

What is the correct answer to this question?

The correct answer is: usermod -s /sbin/nologin apache — Option A is correct because setting the user's login shell to `/sbin/nologin` prevents the user from obtaining an interactive shell via SSH or console login. When the user attempts to log in, the system executes `/sbin/nologin`, which prints a polite message and exits immediately, effectively denying shell access while leaving other services (e.g., Apache) functional.

What should I do if I get this EX200 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: "which command". Tests specific CLI syntax. Recall the exact command and its required context — near-synonyms and partial matches are common distractors.

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

1 more ways this is tested on EX200

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. Which THREE factors determine whether a local user can SSH into a Red Hat Enterprise Linux 9 system? (Choose three.)

hard
  • A.The /etc/nologin file exists.
  • B.The user has sudo privileges.
  • C.The user's shell is listed in /etc/shells.
  • D.The user's ~/.ssh/authorized_keys file exists and has correct permissions.
  • E.The /etc/ssh/sshd_config file allows password or key authentication.

Why C: Option C is correct because SSHd validates that the user's login shell is listed in /etc/shells before allowing authentication. If the shell is not present in /etc/shells (e.g., /sbin/nologin or a custom script), SSHd will deny the connection, even if the user has valid credentials. This check is controlled by the 'AllowUsers' and 'DenyUsers' directives but is a fundamental security measure to prevent users with non-standard shells from gaining interactive access.

Keep practising

More EX200 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 EX200 practice question is part of Courseiva's free Red Hat 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 EX200 exam.