为什么我通过 SSH 登录时仍然看到 MOTD?

IQA*_*eas 1 bash ssh motd sshd bashrc

这是一个新鲜干净的无头Debian 8.7系统,内核3.16.0-4-amd64 ..

当我通过 SSH 登录时,我收到了丑陋的 Debian 版权声明:

Debian GNU/Linux 系统中包含的程序是免费软件;每个程序的确切分发条款在 /usr/share/doc/*/copyright 中的各个文件中进行了描述。

在适用法律允许的范围内,Debian GNU/Linux 不附带任何保证。

我不知道为什么会显示该消息。它已被禁用/etc/ssh/sshd_config

PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
Run Code Online (Sandbox Code Playgroud)

它不是从~/.profile或调用的~/.bashrc。甚至被的内容之前显示的消息/etc/profile/etc/bash.bashrc

甚至没有/etc/update-motd.d目录,只有一个静态/etc/motd文件。这个文件是从哪里神奇地打开的?

Dop*_*oti 6

在Debian衍生的系统,即使PrintMotd设定为nosshd_config中,MOTD仍然呈现为PAM配置的一部分。

例如,在我的 Ubuntu(因此是 Debian 派生的)系统上,在我的 中/etc/pam.d/sshd,我看到:

# Print the message of the day upon successful login.
# 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
session    optional     pam_motd.so noupdate
Run Code Online (Sandbox Code Playgroud)

将这些注释掉可能会抑制您试图消除的消息。