Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2091062

Summary: "error scanning directory" errors from pam_motd
Product: Red Hat Enterprise Linux 8 Reporter: Jonathan Kamens <h1k6zn2m>
Component: pamAssignee: Iker Pedrosa <ipedrosa>
Status: CLOSED ERRATA QA Contact: Anuj Borah <aborah>
Severity: unspecified Docs Contact:
Priority: low    
Version: CentOS StreamCC: aborah, bstinson, ipedrosa, jwboyer, minl, pbrezina, rpm, vkuznets, xiliang, yacao
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pam-1.3.1-25.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2126647 (view as bug list) Environment:
Last Closed: 2023-05-16 09:02:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2126647    

Description Jonathan Kamens 2022-05-27 13:14:38 UTC
With the recently released change to pam_motd to address 2014458, every time someone logs in with SSH I see this in /var/log/secure:

```
May 27 09:10:25 jik4 sshd[2379918]: pam_motd(sshd:session): pam_motd: error scanning directory /etc/motd.d
May 27 09:10:25 jik4 sshd[2379918]: pam_motd(sshd:session): pam_motd: error scanning directory /run/motd.d
May 27 09:10:25 jik4 sshd[2379918]: pam_motd(sshd:session): pam_motd: error scanning directory /usr/lib/motd.d
```

It shouldn't be a loggable error for an optional directory not to exist. This should be handled silently. There shouldn't be unnecessary log noise in /var/log/secure making it harder to find the logs that matter.

Comment 1 minl 2022-05-30 10:26:40 UTC
Met this issue against rhel guest image RHEL-8.7.0-20220529:

1. Create VM  and then check journalctl log:
# journalctl | grep error
May 30 02:21:48 minl-vm-disk-8.7-0529 sshd[4873]: pam_motd(sshd:session): pam_motd: error scanning directory /run/motd.d
# rpm -qa pam
pam-1.3.1-19.el8.x86_64

Additional info:
1. No such error in RHEL-8.6.0-20220420:
# rpm -qa pam
pam-1.3.1-16.el8.x86_64
# journalctl | grep error
# 
2. No such error in 9.1.0-20220529:
# rpm -qa pam
pam-1.5.1-11.el9.x86_64
# journalctl | grep error

Comment 2 Iker Pedrosa 2022-09-12 07:21:39 UTC
*** Bug 2093495 has been marked as a duplicate of this bug. ***

Comment 4 Iker Pedrosa 2022-10-27 14:13:18 UTC
master:
    pam_motd: Cleanup the code and avoid unnecessary logging - d57ab22133654033ee1da89f128a81572d320985
    pam_motd: fix NULL dereference when at least one of motd directories is not available- c2c0434bd634a817f2b16ce7f58fc96c04e88b03

Comment 9 errata-xmlrpc 2023-05-16 09:02:48 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (pam bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:2954