我想知道 /etc/motd 是如何自动更新的(我使用的是 Ubuntu 10.04,服务器版)。我通过网络搜索找到了 update-motd 联机帮助页,但该程序未安装在我的机器上。但是,/etc/motd 文件会定期更新。我只是不知道如何以及多久一次。执行 a 时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
Run Code Online (Sandbox Code Playgroud)
Mar*_*nas 64
它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.
Run Code Online (Sandbox Code Playgroud)
小智 13
上面接受的答案是正确的,但不完整。我希望这能为 OP 提供更多信息。
基本上,在全新安装时,motd 是从三个地方生成的:
/etc/update-motd.d//etc/pam.d/login/etc/legal文件数字 3 是指您的 motd 末尾的文本块,其中包括“Ubuntu 绝对没有保修......”,这就是/etc/legal文件。但是,您将找不到任何/etc/update-motd.d/提及它的内容,也不会在/etc/pam.d/login文件中的任何地方出现“合法”一词。它的包含已经变得模糊,我真的不知道它是如何进入的。我的意思是我知道有一个,{$HOME}/.cache/motd.legal-displayed 但我不知道它来自哪里(还)。
该/etc/pam.d/login文件负责通知待处理的电子邮件,但这并不晦涩。有一个很好的评论描述:
成功登录后打印用户邮箱的状态
...就在文件中。我想从技术上讲,这并不是 motd 的一部分,但它会在登录时显示,如果您是新手,那么可能不会欣赏这种细微的区别。
在 14.04 的全新安装中,没有 /etc/motd文件。如果您创建一个(或创建一个 motd.static 并将其符号链接到 motd),该文件的内容将附加到update-motd.d脚本生成的文本中,但其内容/etc/legal将停止显示。去搞清楚。电子邮件通知仍然出现,所以这不会中断/etc/pam.d/login脚本,所以我怀疑/etc/legal是从那里拉进来的。它的来源对读者来说仍然是个谜。我注意到当我删除/etc/motd链接(或文件)时,法律免责声明不会立即返回。这需要几分钟。我不想经常看到免责声明,所以我从那个文件中删除了文本。
干杯。
小智 10
稍微扩展一下大卫库尔的回答:
全新安装的 Ubuntu Server 14.04.1 LTS 显然没有安装 Landscape-common 和 update-notifier-common 软件包。因此未安装以下脚本:
/etc/update-motd.d/50-landscape-sysinfo
/etc/update-motd.d/90-updates-available
Run Code Online (Sandbox Code Playgroud)
因此,要从从 12.04 LTS 迁移的服务器上获取所有可用的 ssh 登录信息,必须手动安装上述软件包:
sudo apt-get install landscape-common update-notifier-common
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
72697 次 |
| 最近记录: |