PAM-Modules |
|
A Collection of Modules for PAM |
Sergey Poznyakoff |
The pam_umotd
module displays a user-specific message
of the day (MOTD). The text can be taken either from a disk
file, or read from the standard output of a program launched for
that purpose.
This module is Linux-specific.
The module is normally started as a part of the session stack, e.g.:
session optional pam_umotd.so file=/etc/motd
The file option specifies the file to read the MOTD from. By default the output size is limited to 2000 bytes (a usual 80x25 screen-worth of characters). If the input file is bigger than that, it will be truncated. The size limit can be controlled using the max-size parameter:
session optional pam_umotd.so max-size=1024 file=/etc/motd
Another safety-related parameter is max-la, which controls the maximum 5-minute load average, under which the message will be displayed. If the current LA is greater than this value, the module will return immediately without displaying anything1.
The MOTD can be generated on the fly, by launching an external program and displaying its output. This allows you to create dynamic, user-specific MOTDs. To select this mode, use the exec parameter. The rest of arguments after this parameter are taken to be the name of the program to be run and its command line arguments. Before starting the program, the arguments undergo item expansion (see item expansion). For example:
session optional pam_umotd.so max-size=1024 max-la=5.0 timeout=5 \ exec /usr/bin/genmotd ${user} ${tty}
This example runs the program /usr/bin/genmotd passing it the user login name and the tty name as its argument. Notice the timeout parameter, which controls the maximum time (in seconds) the program will be allowed to run. If it runs longer than that, it will be killed. The default timeout is 10 seconds.
This document was generated on August 11, 2021 using makeinfo.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.