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

Ben*_*iga 10 ssh login bashrc

当我 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.
Run Code Online (Sandbox Code Playgroud)

小智 7

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
Run Code Online (Sandbox Code Playgroud)

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

sudo sed -i -e 's/ENABLED=1/ENABLED=0/' /etc/default/motd-news
Run Code Online (Sandbox Code Playgroud)


Art*_*ild 6

在这个文件中:

/etc/pam.d/sshd
Run Code Online (Sandbox Code Playgroud)

注释掉以下两行:

# session    optional     pam_motd.so motd=/run/motd.dynamic
# session    optional     pam_motd.so noupdate
Run Code Online (Sandbox Code Playgroud)

这应该删除 MOTD。

  • 谢谢。这将删除登录时的所有消息(上次登录日期/时间除外)。我本来可以忍受其他东西的,但广告似乎有点多。 (2认同)