Notes on motd

motd - message of the day, the message displayed when logging into a Linux system (for example, Ubuntu).



Previously, the file containing the greeting was located in /etc/motd, but now it is a set of scripts located in the directory /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


The display order is usually in the order of the given priorities - 00, 10, etc.



As a result of execution, it is displayed:



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


Much unnecessary for us - isn't it?



I will disable the part and add my own greeting.



I will create a file and make it executable.



# touch /etc/update-motd.d/99-intelcom
# chmod 755 /etc/update-motd.d/99-intelcom


Now I open it in any editor and add:



#!/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- contains the very welcome Welcome to Ubuntu 18.04.5 LTS (GNU / Linux 4.15.0-118-generic x86_64)

10-help-text- links to information and support

50-landscape-sysinfoleads to a script for getting system information

50-motd-news- some news

80-livepatch- information about Livepatch

80-esm- information about Extended Security Maintenance - Extended maintenance of the security system

Further scripts about updates, reboots, etc.



To disable unnecessary messages, I just give them rights 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


As a result, I got:






All Articles