Notas sobre motd

motd: mensaje del día, el mensaje que se muestra al iniciar sesión en un sistema Linux (por ejemplo, Ubuntu).



Anteriormente, el archivo que contenía el saludo estaba ubicado en /etc/motd, ahora es un conjunto de scripts ubicados en el directorio /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


El orden de visualización, como regla, en el orden de las prioridades dadas: 00, 10, etc.



Como resultado de la ejecución, muestra:



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


Mucho innecesario para nosotros, ¿no?



Deshabilitaré la parte y agregaré mi propio saludo.



Crearé un archivo y lo haré ejecutable.



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


Ahora lo abro en cualquier editor y agrego:



#!/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- contiene la bienvenida bienvenida a Ubuntu 18.04.5 LTS (GNU / Linux 4.15.0-118-genérico x86_64)

10-help-text- enlaces a información y soporte

50-landscape-sysinfoconduce a un script para obtener información del sistema

50-motd-news- algunas noticias

80-livepatch- información sobre Livepatch

80-esm- información sobre Extended Mantenimiento de seguridad: mantenimiento extendido del sistema de seguridad.

Otros scripts sobre actualizaciones, reinicios, etc.



Para deshabilitar mensajes innecesarios, solo les doy derechos 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


Como resultado, obtuve:






All Articles