Red Hat Certified System Administrator RHCSA · Free Practice Question Easy
Question 29
Disable user SSH password-less connection requests on ServerB.
-
A
Pass
-
B
Fail
Reveal correct answer
Correct answer: A
Explanation
Answer:
Edit the SSH Server Configuration File
Command:
# vim /etc/ssh/sshd_configExplanation: The
sshd_configfile controls SSH server settings. Opening it invimallows you to make persistent configuration changes that will impact all SSH connections toServerB. Disabling password-less connections helps secure the server against unauthorized access.
Update Configuration Settings
In
vim, uncomment and adjust the following lines:- PermitEmptyPasswords no
- PubkeyAuthentication no
Explanation of Each Setting:
PermitEmptyPasswords no: This setting ensures that no user can log in without a password, which prevents accounts with empty passwords from accessing the server.PubkeyAuthentication no: Disabling public key authentication (no) restricts users from logging in without a password, even if they have a valid SSH key. This is useful if you need all users to authenticate with a password.
Important Note:
PubkeyAuthentication nodisables all SSH key-based logins. If the goal is only to require passwords for some users, adjust this setting cautiously based on security needs.
Save and Quit
vimCommand: Press
Esc, then type:wqand press Enter.Explanation: This saves the changes to
sshd_configand exitsvim. Make sure the settings are correct before saving, as mistakes insshd_configcould lead to login issues.
Restart the SSH Service to Apply Changes
Command:
# systemctl restart sshdExplanation: Restarting the SSH daemon (
sshd) is essential for applying changes to the configuration file. Without restarting, the updated settings won’t take effect.
Additional Notes and Tips:
Verification:
To confirm that password-less login is disabled, attempt to log in from another terminal or device without specifying a password. If the configuration is correct, SSH will deny access without a password.
You can also check active SSH configuration by running:
- # sshd -T | grep -E "permitemptypasswords|pubkeyauthentication"
This command outputs the effective values of the relevant settings, allowing you to verify changes without testing logins.
Security Implications:
Disabling password-less logins helps protect against unauthorized access and brute force attacks. It’s an important step in hardening SSH, especially in multi-user environments or public-facing servers.Troubleshooting Tips:
Access Issues: If you’re unable to log in after making changes, verify that
sshdis running with# systemctl status sshdand confirm settings insshd_config.Restoring Defaults: If troubleshooting is needed, revert changes in
sshd_configto allow SSH key-based login temporarily or to allow users with existing keys to access the system.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
