为什么我的ssh登录界面包含了类似于TechRepublic文章的宣传?

当我通过ssh登录到我的Ubuntu机器时,我看到了下面的输出。看到引用和指向TechRepublic文章的链接让我感到惊讶。
那是广告吗?有人知道它是从哪里来的吗?有没有办法去掉它?
谢谢, Ben
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是的,我使用Linux,在完全的Linux环境中看到关于macOS的广告真的很让我烦恼。 - sarki_roka
这让我火冒三丈。回到Debian。 - Stewart
3个回答

在这个文件中:
/etc/pam.d/sshd

注释掉以下两行代码:
# session    optional     pam_motd.so motd=/run/motd.dynamic
# session    optional     pam_motd.so noupdate

这将删除MOTD。

2谢谢。这样可以删除登录时的所有消息(除了上次登录的日期/时间)。其他内容我本来还能忍受,但是那个广告似乎有点过分。 - Ben Riga

另一种方法是在配置文件/etc/default/motd-news中指定ENABLED=0。 根据对/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

1这也是在“What exactly is being sent to Ubuntu in the MOTD?”(https://ma.ttias.be/what-exactly-being-sent-ubuntu-motd/)中的首选方式。 - Ganton
1这是一个很好的回答。只删除了“新闻”部分,保留了剩下的半有用的内容。 - Stevie Howard

这篇 TechRepublic 文章的链接来自于每次登录时执行的脚本输出。
/etc/update-motd.d/50-motd-news

你可以通过移除执行权限来禁用那个脚本。
sudo chmod -x /etc/update-motd.d/50-motd-news