My issue is that when I log onto my Ubuntu 19.04 server the SSH login displays the dynamic MOTD twice. I have followed the three following questions but these have not worked for me:
Here are the only mentions of
>/etc/pam.d$ grep -ri "pam_motd.so" /etc/pam.d/
/etc/pam.d/sshd:session optional pam_motd.so motd=/run/motd.dynamic
/etc/pam.d/sshd:# session optional pam_motd.so noupdate
/etc/pam.d/login:# session optional pam_motd.so motd=/run/motd.dynamic
/etc/pam.d/login:# session optional pam_motd.so noupdate
So here we can see only one line is not commented out. When I comment out the one remaining line, the MOTD is not displayed at all, so the problem has been narrowed to the line in
/etc/pam.d/sshd. I have also disabled the PrintMotd option in sshd_config, which has been an issue in the mentioned questions. I have also confirmed that the actual motd.dynamic file is correctly being generated.
Thank you for your help.