我想知道/etc/motd是如何自动更新的(我在Ubuntu10.04服务器版上)。我通过网络搜索找到了更新-motd手册,但是那个程序没有安装在我的机器上。然而,/etc/motd文件定期更新。我只是不知道怎么做和多久一次。在执行locate motd时,将列出以下文件:
/etc/motd
/etc/update-motd.d
/etc/update-motd.d/00-header
/etc/update-motd.d/10-help-text
/etc/update-motd.d/20-cpu-checker
/etc/update-motd.d/50-landscape-sysinfo
/etc/update-motd.d/90-updates-available
/etc/update-motd.d/91-release-upgrade
/etc/update-motd.d/98-reboot-required
/etc/update-motd.d/99-footer
/home/me/.cache/motd.legal-displayed
/lib/security/pam_motd.so
/usr/bin/motd+shell
/usr/lib/update-manager/release-upgrade-motd
/usr/lib/update-notifier/update-motd-cpu-checker
/usr/lib/update-notifier/update-motd-reboot-required
/usr/lib/update-notifier/update-motd-updates-available
/usr/share/base-files/motd.md5sums
/usr/share/man/man1/motd+shell.1.gz
/usr/share/man/man5/motd.5.gz
/usr/share/man/man5/motd.tail.5.gz
/usr/share/man/man5/update-motd.5.gz
/usr/share/man/man8/pam_motd.8.gz
/usr/share/ubuntu-serverguide/html/C/pam_motd.html发布于 2012-02-19 19:26:28
它在登录时由pam_motd更新。更新-motd手册页描述了以下内容:
Ubuntu introduced the update-motd framework, by which the motd(5) is
dynamically assembled from a collection of scripts at login.
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).
On Ubuntu systems, /etc/motd is typically a symbolic link to
/var/run/motd.发布于 2014-08-20 16:49:15
以上所接受的答案是正确的,尽管不完整。我希望这能为行动提供更多的信息。
基本上,在新安装时,motd是从以下三个地方生成的:
/etc/update-motd.d/中的脚本/etc/pam.d/login控制的编译后的二进制文件/etc/legal文件第3条是指在你的/etc/legal文件末尾的文本块,包括"Ubuntu附带绝对没有保修.“。但是,您不会在/etc/update-motd.d/下找到提到它的任何内容,"legal“一词也不会出现在/etc/pam.d/login文件的任何地方。它被模糊了,我真的不知道它是怎么进来的。我的意思是,我知道有一个{$HOME}/.cache/motd.legal-displayed,但我不知道它是从哪里来的(目前为止)。
/etc/pam.d/login文件负责通知挂起的电子邮件,但这并不是模糊的。有一条很好的评论描述了:
成功登录时打印用户邮箱的状态
文件中的...right。我想,从技术上讲,这并不是motd的一部分,但是它在登录时就会出现,如果您是新手,那么这种细微的区别可能不会被欣赏。
在新安装14.04时,没有/etc/motd文件。如果您创建一个(或者创建一个motd.static并将其符号链接到motd),那么该文件的内容将被附加到update-motd.d脚本生成的文本中,但是/etc/legal的内容将停止显示。去想一想。电子邮件通知仍然出现,所以这不会中断/etc/pam.d/login脚本,所以我怀疑/etc/legal是从那里拉进来的。它的来源对读者来说仍然是个谜。我注意到当我删除/etc/motd链接(或文件)时,合法的免责声明不会立即恢复。只需要几分钟。我不想经常看到免责声明,所以我从文件中删除了文本。
干杯。
发布于 2015-01-07 21:38:53
要在戴维·库尔上稍微扩展一下答案:
UbuntuServer14.04.1LTS的新安装显然不安装通用或更新通知程序公共软件包。因此,没有安装以下脚本:
/etc/update-motd.d/50-landscape-sysinfo
/etc/update-motd.d/90-updates-available因此,要从从12.04 LTS迁移的服务器获取所有可用的ssh登录信息,必须手动安装上述软件包:
sudo apt-get install landscape-common update-notifier-commonhttps://askubuntu.com/questions/105689
复制相似问题