How to display /etc/motd and /etc/motd.d/* when ssh login on RHEL9 ?

Solution Verified - Updated -

Issue

  • PrintMotd parameter in /etc/ssh/sshd_config is not effective on RHEL9. Even if it is set as default yes, /etc/motd and /etc/motd.d/* are not displayed when ssh login on one RHEL9 server.
    (pam_motd.so is no set or commented out in /etc/pam.d/sshd at the same time.)

    [root@rhel9 ~]# grep -i motd /etc/ssh/sshd_config
    PrintMotd yes
    [root@rhel9 ~]# grep -i motd /etc/pam.d/sshd 
    # session    optional     pam_motd.so
    [root@rhel9 ~]# ls -l /etc/motd*
    -rw-r--r--. 1 root root 15 Jan 23 13:13 /etc/motd
    
    /etc/motd.d:
    total 0
    lrwxrwxrwx. 1 root root 22 Nov 13 20:59 cockpit -> ../../run/cockpit/motd
    lrwxrwxrwx. 1 root root 41 Nov 13 20:59 insights-client -> /etc/insights-client/insights-client.motd
    

    (On ssh client)

    [root@test ~]# ssh rhel9
    root@rhel9's password: 
    Last login: Wed Mar 26 12:45:20 2025 from 192.168.X.XX
    [root@rhel9 ~]#
    

Environment

  • Red Hat Enterprise Linux (RHEL) 9
  • openssh

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content