To disable root login over SSH, modify the /etc/ssh/sshd_config file using:
bash
sed -i 's/PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config
Then restart the SSH service:
bash
systemctl restart sshd
Options A, C, and D are invalid or syntactically incorrect.
Only B makes a valid and permanent configuration change.
[Reference:CompTIA Linux+ XK0-005 Official Study Guide, Domain 3.2 – Implement authentication and authorization, “To harden SSH, edit /etc/ssh/sshd_config and set PermitRootLogin no.”, ]
Submit