- A
usermod -s /sbin/nologin apache
Sets shell to nologin, blocking interactive login.
- B
passwd -l apache
Why wrong: Locks password but doesn't prevent SSH key login.
- C
chage -l apache
Why wrong: Lists password expiry; does not restrict login.
- D
usermod -e 1 apache
Why wrong: Sets account expiration; doesn't prevent immediate login.
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.
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.
- →
Manage security — study guide chapter
Learn the concepts, then practise the questions
- →
Manage security practice questions
Targeted practice on this topic area only
- →
All EX200 questions
527 questions across all exam domains
- →
Red Hat Certified System Administrator EX200 study guide
Full concept coverage aligned to exam objectives
- →
EX200 practice test guide
How to use practice tests most effectively before exam day
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.
Operate running systems practice questions
Practise EX200 questions linked to Operate running systems.
Configure local storage practice questions
Practise EX200 questions linked to Configure local storage.
Create and configure file systems practice questions
Practise EX200 questions linked to Create and configure file systems.
Deploy, configure, and maintain systems practice questions
Practise EX200 questions linked to Deploy, configure, and maintain systems.
Manage users and groups practice questions
Practise EX200 questions linked to Manage users and groups.
Manage security practice questions
Practise EX200 questions linked to Manage security.
Manage containers practice questions
Practise EX200 questions linked to Manage containers.
Create simple shell scripts practice questions
Practise EX200 questions linked to Create simple shell scripts.
Essential Tools practice questions
Practise EX200 questions linked to Essential Tools.
EX200 fundamentals practice questions
Practise EX200 questions linked to EX200 fundamentals.
EX200 scenario practice questions
Practise EX200 questions linked to EX200 scenario.
EX200 troubleshooting practice questions
Practise EX200 questions linked to EX200 troubleshooting.
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 →
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
- A system administrator needs to find all regular files larger than 10MB in /var/log. Which find command should they use?
- A user needs to view the last 15 lines of a log file that is constantly being updated. Which command should they use?
- Which TWO statements about systemd journal and rsyslog are correct?
- A system administrator needs to ensure that a specific process continues to run even if it crashes. The process is start…
- A system administrator needs to ensure that a web server running Apache httpd starts automatically after a system reboot…
- Refer to the exhibit. The administrator wants to create a single file system that spans the entire 20 GB disk /dev/sdb.…
Last reviewed: Jun 11, 2026
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.
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.
Sign in to join the discussion.