LX0-104 · 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 only users listed in /etc/sshd/sshd.allow using pam_listfile.so, the configuration line auth required pam_listfile.so item=user sense=allow file=/etc/sshd/sshd.allow onerr=fail is correct.
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
(24 responses)- A13% (3)
- B4% (1)
- C79% (19)
- D4% (1)
Why each option
To restrict SSH logins to only users listed in `/etc/sshd/sshd.allow` using `pam_listfile.so`, the configuration line `auth required pam_listfile.so item=user sense=allow file=/etc/sshd/sshd.allow onerr=fail` is correct.
Using `sense=deny` would mean users in `/etc/sshd/sshd.deny` are denied, but `onerr=succeed` would allow access if the deny file isn't found, which is a security risk.
Using `onerr=succeed` with `sense=allow` means if `/etc/sshd/sshd.allow` cannot be read, the module would succeed, potentially allowing unauthorized users to log in.
The `item=user` specifies to check the username, `sense=allow` means to permit access only if the user is found in the specified `file`, and `onerr=fail` ensures that if the file cannot be accessed or read, the authentication attempt will fail, enhancing security by failing safe.
Using `sense=deny` with `onerr=fail` means users listed in `/etc/sshd/sshd.deny` would be denied, and if the file is unreadable, it fails (denies), but the question implies restricting to a list, not denying from a list.
Concept tested: PAM pam_listfile.so configuration
Source: https://linux.die.net/man/8/pam_listfile
Topics
Community Discussion
No community discussion yet for this question.