Ubuntu

如何在 Ubuntu 中配置登錄消息?

  • December 27, 2021

每次我通過 SSH 連接到我的 AWS Ubuntu 伺服器時,我都會看到一條系統資訊消息,其中顯示了負載、記憶體使用情況和可安裝的軟體包,如下所示:

Welcome to Ubuntu 12.04.3 LTS (GNU/Linux 3.2.0-51-virtual x86_64)

* Documentation:  https://help.ubuntu.com/

 System information as of Sun Nov 10 18:06:43 EST 2013

 System load:  0.08              Processes:           127
 Usage of /:   4.9% of 98.43GB   Users logged in:     1
 Memory usage: 69%               IP address for eth0: 10.236.136.233
 Swap usage:   100%

 Graph this data and manage this system at https://landscape.canonical.com/

13 packages can be updated.
0 updates are security updates.

Get cloud support with Ubuntu Advantage Cloud Guest
 http://www.ubuntu.com/business/services/cloud

Use Juju to deploy your cloud instances and workloads.
 https://juju.ubuntu.com/#cloud-precise
*** /dev/xvda1 will be checked for errors at next reboot ***

*** System restart required ***

我的問題是,該消息是如何創建的?我該如何配置它?

此登錄消息是由 Ubuntu 的landscape軟體包創建的。就個人而言,我認為它們很煩人,因此,已配置 ansible 來核對這些軟體包並設置空白登錄消息。

要做到這一點:

$ apt-get remove landscape-client landscape-common 
$ rm -f /etc/motd && touch /etc/motd

這將創建一個空白/etc/motd。要設置自定義登錄消息,請根據需要編輯該文件。

就我而言,我必須 clear /etc/update-motd.d/51-cloudguest,內容如下:

#!/bin/sh
#
# This file is written by the Ubuntu image build process, it is not
# managed by a package.  If you want to avoid seeing this advertisement,
# then you can safely remove the file.
echo ""
echo "  Get cloud support with Ubuntu Advantage Cloud Guest:"
echo "    http://www.ubuntu.com/business/services/cloud"
echo ""
echo "  Use Juju to deploy your cloud instances and workloads:"
echo "    https://juju.ubuntu.com/#cloud-saucy"

引用自:https://serverfault.com/questions/554022