LPIC-2 System Security Practice Question
Which two commands correctly configure SSH to disable root login? (Select two.)
⚠ Common exam trap
Many candidates confuse `PermitRootLogin without-password` (which still allows key-based root login) with disabling root login entirely, or they mistakenly edit the client-side `ssh_config` instead of the server-side `sshd_config`.
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
✓
echo "DenyUsers root" >> /etc/ssh/sshd_config
`DenyUsers root` in `/etc/ssh/sshd_config` explicitly prevents the root user from logging in via SSH, regardless of other authentication methods. Option E is correct because `PermitRootLogin no` directly disables all root SSH logins (password, key, or otherwise) in the SSH server configuration. Both directives require a subsequent restart or reload of the sshd service to take effect.
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 -L root
Why it's wrong here
This locks the root password but does not prevent key-based SSH login.
- ✗
echo "PermitRootLogin without-password" >> /etc/ssh/sshd_config
Why it's wrong here
This still allows root login with key-based authentication.
- ✓
echo "DenyUsers root" >> /etc/ssh/sshd_config
Why this is correct
This explicitly denies root user from SSH login.
- ✗
echo "PermitRootLogin yes" >> /etc/ssh/ssh_config
Why it's wrong here
This modifies the client configuration and allows root login.
- ✓
echo "PermitRootLogin no" >> /etc/ssh/sshd_config
Why this is correct
This disables all root login via SSH.
Go deeper
Related to this question
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 →
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.