motd-每日消息,是登录Linux系统(例如Ubuntu)时显示的消息。
以前,包含问候语的文件位于中/etc/motd
,但是现在它是位于目录中的一组脚本/etc/update-motd.d/
:
# ls -alh /etc/update-motd.d/
total 56K
drwxr-xr-x 2 root root 4,0K 22 2020 .
drwxr-xr-x 98 root root 4,0K 27 15:31 ..
-rwxr-xr-x 1 root root 1,2K 9 2018 00-header
-rwxr-xr-x 1 root root 1,2K 9 2018 10-help-text
lrwxrwxrwx 1 root root 46 22 2020 50-landscape-sysinfo -> /usr/share/landscape/landscape-sysinfo.wrapper
-rwxr-xr-x 1 root root 4,2K 20 2018 50-motd-news
-rwxr-xr-x 1 root root 604 21 2018 80-esm
-rwxr-xr-x 1 root root 3,0K 21 2018 80-livepatch
-rwxr-xr-x 1 root root 97 12 2018 90-updates-available
-rwxr-xr-x 1 root root 299 3 2019 91-release-upgrade
-rwxr-xr-x 1 root root 129 12 2018 95-hwe-eol
-rwxr-xr-x 1 root root 111 20 2018 97-overlayroot
-rwxr-xr-x 1 root root 142 12 2018 98-fsck-at-reboot
-rwxr-xr-x 1 root root 144 12 2018 98-reboot-required
显示顺序通常是给定优先级的顺序-00、10等。
执行结果显示为:
Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 4.15.0-118-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Fri Nov 13 14:30:00 +08 2020
System load: 0.45
Usage of /: 9.8% of 109.84GB
Memory usage: 6%
Swap usage: 0%
Processes: 152
Users logged in: 0
IP address for enp4s0: 192.168.106.12
IP address for enxd037454bea65: 172.17.8.58
IP address for tun0: 10.8.0.1
IP address for docker0: 172.17.0.1
* Introducing self-healing high availability clustering for MicroK8s!
Super simple, hardened and opinionated Kubernetes for production.
https://microk8s.io/high-availability
* Canonical Livepatch is available for installation.
- Reduce system reboots and improve kernel security. Activate at:
https://ubuntu.com/livepatch
233 .
174 .
New release '20.04.1 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
Last login: Fri Nov 13 08:21:33 2020 from 85.192.x.214
对我们来说没有太多必要了,不是吗?
我将禁用该部分并添加自己的问候语。
我将创建一个文件并使它可执行。
# touch /etc/update-motd.d/99-intelcom
# chmod 755 /etc/update-motd.d/99-intelcom
现在,我可以在任何编辑器中打开它并添加:
#!/bin/bash
echo -e '\033[34m#######################################################
#\033[33m PBX Intelcom - VoIP "" \033[34m#
#\033[33m www.a*p.ru .(3532)54-0X-0Y \033[34m#
#######################################################\033[0m'
-e
— Escape , \033[34m
\033[33m
— , \033[0m
— .
:
\033[30m
— ;
\033[31m
— ;
\033[32m
— ;
\033[33m
— ;
\033[34m
— ;
\033[35m
— ;
\033[36m
— ;
\033[37m
— .
:
\033[40m
— ;
\033[41m
— ;
\033[42m
— ;
\033[43m
— ;
\033[44m
— ;
\033[45m
— ;
\033[46m
— ;
\033[47m
— ;
\033[0m
— .
sudo run-parts /etc/update-motd.d
cat /var/run/motd.dynamic
.
00-header
-包含非常受欢迎的内容欢迎使用Ubuntu 18.04.5 LTS(GNU / Linux 4.15.0-118-通用x86_64)
10-help-text
-信息链接和支持
50-landscape-sysinfo
导致获取系统信息的脚本
50-motd-news
-一些新闻
80-livepatch
-有关Livepatch的
80-esm
信息-有关Extended的信息安全维护-安全系统的扩展维护
有关更新,重启等的更多脚本。
要禁用不必要的消息,我只授予他们权限400
。
Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 4.15.0-118-generic x86_64)
-rwxr-xr-x 1 root root 1,2K 9 2018 00-header
-r-------- 1 root root 1,2K 9 2018 10-help-text
lrwxrwxrwx 1 root root 46 30 13:45 50-landscape-sysinfo -> /usr/share/landscape/landscape-sysinfo.wrapper
-r-------- 1 root root 4,9K 14 02:59 50-motd-news
-r-------- 1 root root 604 22 2018 80-esm
-r-------- 1 root root 3,0K 22 2018 80-livepatch
-r-------- 1 root root 97 27 2018 90-updates-available
-r-------- 1 root root 299 19 2017 91-release-upgrade
-rwxr-xr-x 1 root root 165 17 2020 92-unattended-upgrades
-rwxr-xr-x 1 root root 129 27 2018 95-hwe-eol
-rwxr-xr-x 1 root root 111 27 2017 97-overlayroot
-rwxr-xr-x 1 root root 142 27 2018 98-fsck-at-reboot
-rwxr-xr-x 1 root root 144 27 2018 98-reboot-required
-rwxr-xr-x 1 root root 324 13 13:36 99-intelcom
结果,我得到了: