LFCS · Question #418
The system administrator wishes to use the pam_listfile.so module to restrict which users are allowed to login via SSH. Which line will configure this behaviour?
The correct answer is C. auth required pam_listfile.so item=user sense=allow file=/etc/sshd/sshd.allow onerr=fail. To restrict SSH logins to specific users via pam_listfile.so, the configuration must explicitly allow users listed in a file and ensure failure if the file is unreadable.
Question
Options
- Aauth required pam_listfile.so item=user sense=deny file=/etc/sshd/sshd.deny onerr=succeed
- Bauth required pam_listfile.so item=user sense=allow file=/etc/sshd/sshd.allow onerr=succeed
- Cauth required pam_listfile.so item=user sense=allow file=/etc/sshd/sshd.allow onerr=fail
- Dauth required pam_listfile.so item=user sense=deny file=/etc/sshd/sshd.deny onerr=fail
How the community answered
(15 responses)- A7% (1)
- B13% (2)
- C80% (12)
Why each option
To restrict SSH logins to specific users via `pam_listfile.so`, the configuration must explicitly allow users listed in a file and ensure failure if the file is unreadable.
`sense=deny` would prevent listed users from logging in, which is the opposite of the desired 'restrict which users are allowed' (implying a whitelist); `onerr=succeed` is also a security risk, allowing access if the file is missing or unreadable.
While `sense=allow` is correct, `onerr=succeed` is a security risk as it would allow all users to log in if the allow file is missing or unreadable, compromising the restriction.
This line correctly uses `pam_listfile.so` to check the `user` (`item=user`), `allow` (`sense=allow`) users listed in `/etc/sshd/sshd.allow` (`file=/etc/sshd/sshd.allow`), and critically, `fail` (`onerr=fail`) if the file cannot be accessed, which prevents an insecure fallback and ensures security.
`sense=deny` would block listed users, not allow only a specified list; while `onerr=fail` is generally more secure, the `sense` parameter is incorrect for an allowlist.
Concept tested: PAM `pam_listfile.so` configuration
Source: https://manpages.debian.org/unstable/libpam-doc/pam_listfile.8.en.html
Topics
Community Discussion
No community discussion yet for this question.