我想更改在 TTY 上登录计算机时显示的 MOTD,这似乎有效,但不知何故,它不仅在/etc/motd和 中显示 MOTD /etc/update-motd.d/,而且还显示另一条消息。
这在我登录到我的服务器时显示:
sam@laptop:~$ ssh <user>@<server>
Welcome to Ubuntu 12.04.2 LTS (GNU/Linux 2.6.32-042stab068.8 i686)
* Documentation: https://help.ubuntu.com/
No mail.
Last login: Thu Feb 21 19:20:55 2013 from <ip>
Welcome to Ubuntu 12.04.2 LTS (GNU/Linux 2.6.32-042stab068.8 i686)
* Documentation: https://help.ubuntu.com/
<user>@<server>:~$
Run Code Online (Sandbox Code Playgroud)
我的update-motd.d包含两个文件,00-header和10-help-text.
00-header 包含以下内容:
[ -r /etc/lsb-release ] && . /etc/lsb-release
if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
# Fall back to using the very slow lsb_release utility
DISTRIB_DESCRIPTION=$(lsb_release -s -d)
fi
printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)"
Run Code Online (Sandbox Code Playgroud)
并10-help-text包含以下内容:
[ -r /etc/lsb-release ] && . /etc/lsb-release
if [ -z "$DISTRIB_RELEASE" ] && [ -x /usr/bin/lsb_release ]; then
# Fall back to using the very slow lsb_release utility
DISTRIB_RELEASE=$(lsb_release -sr)
fi
URL="https://help.ubuntu.com/"
if uname -r | grep -qs "\-server"; then
URL="https://help.ubuntu.com/$DISTRIB_RELEASE/serverguide/C"
fi
printf "\n * Documentation: %s\n" "$URL"
Run Code Online (Sandbox Code Playgroud)
这将弥补直到 的 MOTD 部分No mail.。但其余的来自哪里?
mgo*_*ven 13
MOTD 可以由sshd或 PAM打印。有可能两者都在做。
检查您/etc/ssh/sshd_config的以下内容:
PrintMotd yes
Run Code Online (Sandbox Code Playgroud)
如果该行不存在,则它可能默认为yes(尽管 Debian/Ubuntu 将默认值更改为no)。
检查您的 PAM 配置以/etc/pam.d/了解以下内容:
session optional pam_motd.so
Run Code Online (Sandbox Code Playgroud)
尝试一次禁用这些,看看有什么变化。
| 归档时间: |
|
| 查看次数: |
11851 次 |
| 最近记录: |