nerdexam
CompTIA

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.

Security

Question

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?

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)
  • A
    13% (3)
  • B
    4% (1)
  • C
    79% (19)
  • D
    4% (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.

Aauth required pam_listfile.so item=user sense=deny file=/etc/sshd/sshd.deny onerr=succeed

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.

Bauth required pam_listfile.so item=user sense=allow file=/etc/sshd/sshd.allow onerr=succeed

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.

Cauth required pam_listfile.so item=user sense=allow file=/etc/sshd/sshd.allow onerr=failCorrect

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.

Dauth required pam_listfile.so item=user sense=deny file=/etc/sshd/sshd.deny onerr=fail

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

#PAM#SSH#user access control#pam_listfile.so

Community Discussion

No community discussion yet for this question.

Full LX0-104 Practice