Fedora Linux default pam_motd configuration don't show content of motd_dir at starting session (except for ssh)

By default, Fedora Linux displays all motd messages (including the motd file and the motd.d directory) in connection with ssh, but in other cases when opening a session (TTY) only the motd file without the motd.d directory. Where is this configured to work like this? And why is it configured like this?

1 Like

Hello @karpse ,
Welcome to :fedora: !
What you are likely describing is the difference between a login shell (via ssh) and an interactive shell started after login. Refer to what type of shell is started when opening your preferred terminal emulator.

No, shell does not respond motd messages. Pam’s module pam_motd prints a motd message at session start before starting shell.

" The contents of /etc/motd are displayed by login(1) after a successful login but just before it executes the login shell."
https://man.archlinux.org/man/motd.5.en
“pam_motd is a PAM module that can be used to display arbitrary motd (message of the day) files after a successful login. By default, pam_motd shows files in the following locations:”
https://man.archlinux.org/man/pam_motd.8.en

1 Like

Do anyone have any ideas?

Okay, I have some progress here. By default, pam_motd on Fedora Linux is configured to start only for ssh logins (see /etc/pam.d/sshd and /etc/pam.d/login). However, by default the message of motd file (while motd_dir is not) is displayed at TTY login. Well, I tried to configure the login as intended by pam (i.e. /etc/pam.d/login). After that, the pam_motd.so pam module displays the motd file and the motd_dir directory correctly. However, then the login looks like this:

fedora login: user
Passwrod: 
content of motd file
content of motd_dir files
Last login: Tue Nov 1 bla bla
content of motd file

The clip printed before the last log entry is from pam_motd. The latter is apparently some other program that reads and prints the motd file. What program does this? Why doesn’t Fedora Linux use pam_motd? This is confusing and stypid…

This thread is moved to here.