为什么我的 ssh 登录信息中包含看起来像是 TechRepublic 文章的促销信息?

为什么我的 ssh 登录信息中包含看起来像是 TechRepublic 文章的促销信息?

当我通过 ssh 进入我的 Ubuntu 机器时,我看到了下面的输出。我很惊讶地看到了引用和 TechRepublic 文章的链接。

这是广告吗?有人知道这是从哪里来的吗?有没有什么办法可以删除它?

谢谢,本

Welcome to Ubuntu 20.04 LTS (GNU/Linux 5.4.0-37-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Sun 21 Jun 2020 10:06:54 PM PDT

  System load:  0.05                Processes:                249
  Usage of /:   43.6% of 227.74GB   Users logged in:          0
  Memory usage: 8%                  IPv4 address for enp0s25: <redacted>
  Swap usage:   0%                  IPv4 address for wlp2s0:  <redacted>
  Temperature:  56.0 C

 * "If you've been waiting for the perfect Kubernetes dev solution for
   macOS, the wait is over. Learn how to install Microk8s on macOS."

   https://www.techrepublic.com/article/how-to-install-microk8s-on-macos/

0 updates can be installed immediately.
0 of these updates are security updates.

答案1

在此文件中:

/etc/pam.d/sshd

注释掉以下2行:

# session    optional     pam_motd.so motd=/run/motd.dynamic
# session    optional     pam_motd.so noupdate

这应该会删除 MOTD。

答案2

ENABLED=0另一种方法是在配置文件中指定/etc/default/motd-news。根据以下内容,这可能是首选/etc/update-motd.d/50-motd-news

$ grep -A5 Source /etc/update-motd.d/50-motd-news
# Source the local configuration
[ -r /etc/default/motd-news ] && . /etc/default/motd-news

# Exit immediately, unless we're enabled
# This makes this script very easy to disable in /etc/default/motd-news configuration
[ "$ENABLED" = "1" ] || exit 0

您可以/etc/default/motd-news在您选择的编辑器中更新,或者使用 sed 或 perl。请注意,需要 root 权限:

sudo sed -i -e 's/ENABLED=1/ENABLED=0/' /etc/default/motd-news

答案3

TechRepublic 文章的链接来自此脚本的输出,该脚本在每次登录时执行:

/etc/update-motd.d/50-motd-news

您可以通过删除执行权限来禁用该脚本:

sudo chmod -x /etc/update-motd.d/50-motd-news

相关内容