我知道pam_motd在登录时更新了MOTD,但是有时候MOTD只是几天没有更新,我很困惑是什么原因。我想将uptime和who输出添加到MOTD中,从/etc/update-motd.d/脚本中正确地调用它们,但是如果向用户显示过时的信息似乎是毫无意义的。
来自update-motd手册页:
Executable scripts in /etc/update-motd.d/* are executed by pam_motd(8) as
the root user at each login, and this information is concatenated in /var/run/motd.
The order of script execution is determined by the run-parts(8) --lsbsysinit option
(basically alphabetical order, with a few caveats).据我理解,MOTD应该在每次登录时更新。但事实并非如此,而且我也找不到手动更新MOTD的脚本。我可以在run-parts中添加一个cron行,但是我不认为它是解决这个问题的正确方法,因为它感觉像是一个黑客或解决方法。
我最后的希望是像这样设置/etc/pam.d/login:
# Prints the message of the day upon succesful login.
# (Replaces the `MOTD_FILE' option in login.defs)
# This includes a dynamically generated part from /run/motd.dynamic
# and a static (admin-editable) part from /etc/motd.
#session optional pam_motd.so motd=/run/motd.dynamic noupdate
session optional pam_motd.so motd=/run/motd.dynamic
session optional pam_motd.so我原以为删除noupdate会解决问题,但事实并非如此。
发布于 2014-03-29 23:44:15
我最近遇到了同样的问题。您还需要编辑/etc/pam.d/sshd以删除或注释noupdate。
https://askubuntu.com/questions/403788
复制相似问题