A Linux administrator discovers that the account reports_user can open an interactive shell with ssh, even though the account should be limited to Secure File Transfer Protocol (SFTP) uploads on port 22. The change must apply only to that one account and must not affect other users who legitimately need full SSH access. Which single modification to /etc/ssh/sshd_config best meets the requirement?
A reboot is not an acceptable solution; the fix must take effect after the standard sshd service reload.
Change reports_user's login shell in /etc/passwd to /sbin/nologin.
Add DenyUsers reports_user to sshd_config and restart the sshd service.
Replace the existing SFTP Subsystem line with Subsystem sftp internal-sftp.
Append a Match block for reports_user that contains ForceCommand internal-sftp, then reload sshd.
Adding a Match block that contains ForceCommand internal-sftp for the specific user forces the OpenSSH daemon to launch the in-process SFTP server whenever that user authenticates. Because the command is forced by the server, any attempt to request an interactive shell is ignored, yet file-transfer capability remains intact. Substituting the Subsystem line only changes which SFTP program is used and does not block a shell. Changing the account's login shell to /sbin/nologin or denying the user would also eliminate SFTP access, violating the requirement. Therefore, the Match block with ForceCommand internal-sftp is the least disruptive and correct solution.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the purpose of a Match block in the sshd_config file?
Open an interactive chat with Bash
What does the ForceCommand directive do in sshd_config?
Open an interactive chat with Bash
How does the `internal-sftp` subsystem differ from external SFTP programs?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Security
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access