11.04 中 motd.tail 的对应内容是什么?

11.04 中 motd.tail 的对应内容是什么?

motd.tail根据以下规定已弃用此错误报告

motd(5) says: "The contents of this file are regenerated upon every system
boot based on the contents of /etc/motd.tail." This is not true anymore, as
Ubuntu uses the update-motd framework. Any reference to motd.tail should be
replaced with a reference to the update-motd framework or update-motd(5).
The manpage for motd.tail should be removed.

我使用它来在登录时识别我的服务器并确保我在正确的机器上,所以我不需要任何动态的东西,只需要一条简单的消息。

motd.tail与 Ubuntu 11.04 兼容的功能(在 MOTD 末尾附加一条小消息)相当于什么?

答案1

要直接回答问题,只需编辑/etc/update-motd.d/99-footer

/etc/update-motd.d/是一个相当标准的配置转储,按文件名排序。99-footer是其中的最后一项,因此最后将其固定。在 Natty 中,默认情况下,它只是检查是否有一个文件被调用/etc/motd.tail,如果有,它会将其附加到 motd:

[ -f /etc/motd.tail ] && cat /etc/motd.tail || true

所以你有两个选择。你可以向其中添加一些逻辑以仅输出echo一些输出(毕竟这是一个 shell 脚本,而不是文本文件),也可以创建(或者编辑,如果你已经有了一个)/etc/motd.tail。无论哪种方式都是完全有效的。

答案2

根据 Ubuntu 服务器指南,按数字顺序pam_motd执行脚本。 脚本的输出将写入 /var/run/motd,保持数字顺序,然后与 /etc/motd.tail 连接。/etc/update-motd.d

更多信息请见这里

相关内容