PAM_MOTD(8)

๐Ÿ’– pam_motd โ€” bestie's guide to the message of the day ๐Ÿ’–

okay so real talk, this is pam_motd from the Linux-PAM Manual (section 8, system administration girlies rise up ๐Ÿ’…). she's a PAM module and she's literally just here to show you a lil message after you log in. iconic behavior, no cap.


โœจ NAME โœจ

pam_motd โ€” display the motd file ๐ŸŽ€


โœจ SYNOPSIS โœจ

pam_motd.so [motd=/path/filename] [motd_dir=/path/dirname.d]

โœจ DESCRIPTION โœจ

so pam_motd is a PAM module that shows arbitrary motd (message of the day) files after a successful login ๐Ÿซถ. by default she's showing you files from these locations, periodt:

/etc/motd
/run/motd
/usr/lib/motd
/etc/motd.d/
/run/motd.d/
/usr/lib/motd.d/

each message is capped at 64KB โ€” we love a size limit, it's giving boundaries ๐Ÿ’….

if /etc/motd doesn't exist, then /run/motd gets shown instead. and if /run/motd doesn't exist either, then it's /usr/lib/motd's time to shine โœจ.

same overriding energy applies to the directories, fr fr. files in /etc/motd.d/ override files with the same name in /run/motd.d/ and /usr/lib/motd.d/. and files in /run/motd.d/ override files with the same name in /usr/lib/motd.d/. it's giving hierarchy, it's giving main character energy ๐Ÿ‘‘.

files in the directories listed above get displayed in lexicographic order by name ๐Ÿฆ‹. and on top of that, the files are filtered by reading them with the credentials of the target user authenticating on the system. very demure, very mindful.

now, to silence a message? you can place a symbolic link with target /dev/null in /etc/motd.d with the same filename as the message you wanna silence. not me ghosting a motd file ๐Ÿ˜ญ. example: creating a symbolic link like this silences /usr/lib/motd.d/my_motd.

ln -s /dev/null /etc/motd.d/my_motd

and listen โ€” the MOTD_SHOWN=pam environment variable is set after showing the motd files, even when all of them were silenced using symbolic links. she always shows up to the function, even when the vibes are quiet ๐ŸŒธ.


โœจ OPTIONS โœจ

  • motd=/path/filename โ€” the /path/filename file gets displayed as the message of the day ๐Ÿ’–. you can specify multiple paths to try as a colon-separated list. by default this option is set to /etc/motd:/run/motd:/usr/lib/motd.
  • motd_dir=/path/dirname.d โ€” the /path/dirname.d directory gets scanned and every file inside of it gets displayed ๐ŸŒˆ. multiple directories to scan can be specified as a colon-separated list. by default this option is set to /etc/motd.d:/run/motd.d:/usr/lib/motd.d.
๐Ÿšจ heads up bestie: when no options are given, the default behavior applies for both options. but specifying either option (or both!) will disable the default behavior for both options. that's the whole plot twist ๐Ÿ’€.

โœจ MODULE TYPES PROVIDED โœจ

only the session module type is provided. just the one. she's specialized ๐ŸŽ€.


โœจ RETURN VALUES โœจ

  • PAM_ABORT โ€” not all relevant data or options could be obtained ๐Ÿ˜ญ.
  • PAM_BUF_ERR โ€” memory buffer error ๐Ÿ™ˆ.
  • PAM_IGNORE โ€” this is the default return value of this module โœจ.

โœจ EXAMPLES โœจ

the suggested usage for /etc/pam.d/login is:

session  optional  pam_motd.so

to use a motd file from a different location:

session  optional  pam_motd.so motd=/elsewhere/motd

to use a motd file from elsewhere, along with a corresponding .d directory:

session  optional  pam_motd.so motd=/elsewhere/motd motd_dir=/elsewhere/motd.d

โœจ SEE ALSO โœจ

motd(5), pam.conf(5), pam.d(5), pam(8) โ€” go read those too, iykyk ๐Ÿ“š


โœจ AUTHOR โœจ

pam_motd was written by Ben Collins <bcollins@debian.org> ๐Ÿ’œ.

the motd_dir= option was added by Allison Karlitskaya <allison.karlitskaya@redhat.com> ๐Ÿ’–.


and that's the whole page bestie!! ๐ŸŽ€ this was Linux-PAM, dated 09/27/2026 โ€” slay, ate, left no crumbs, and logged you in with a cute lil message on the way ๐Ÿ’…โœจ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from