How does /etc/motd.d directory works?

Okey, I reinstalled Rocky Linux and all works as it should. The order of values ​​works (first /etc/motd and /etc/motd.d, then /run/motd and /run/motd.d, etc.), when logging into the system pam_motd shows content of the motd file at the top and then content of all motd.d files and not .motd extension ​​needed. So everything works as I originally assumed, that it should work and there is no more confusion with these, thank you. Now I’m just trying to get it working on other distros, or I’ll use Rocky Linux, we’ll see.

Example:

$ cat /etc/motd
This is motd file
$ cat /etc/motd.d/10-welcome
Welcome from motd directory
$ cat /etc/motd.d/20-message
Todays message from motd directory
$ cat motd.d/*
Welcome from motd directory
Today's message from motd directory
$ ssh localhost
user@localhost's password: 
This is motd file
Welcome from motd directory
Todays message from motd directory
Welcome from motd directory
Last login: Sun Oct 30 14:53:06 2022 from 0.0.0.0
1 Like