ユーザ用ツール

サイト用ツール


サイドバー

このページの翻訳:



最近の更新



Tag Cloud

50_dialy:2022:08:31

2022.08.31 ubuntu motd

ubuntuでmotdを修正する方法

/etc/update-motd.d/以下のスクリプトが実行されている

root@regist01:~# ls -al /etc/update-motd.d/
total 68
drwxr-xr-x   2 root root 4096 Aug 31 06:32 .
drwxr-xr-x 100 root root 4096 Aug 31 06:28 ..
-rwxr-xr-x   1 root root 1220 Dec  5  2019 00-header
-rwxr-xr-x   1 root root 1157 Dec  5  2019 10-help-text
lrwxrwxrwx   1 root root   46 Aug 24  2021 50-landscape-sysinfo -> /usr/share/landscape/landscape-sysinfo.wrapper
-rwxr-xr-x   1 root root 5023 Aug 17  2020 50-motd-news
-rwxr-xr-x   1 root root   96 Jul 23  2021 85-fwupd
-rwxr-xr-x   1 root root  106 Jul 27  2021 88-esm-announce
-rwxr-xr-x   1 root root  218 May 14  2021 90-updates-available
-rwxr-xr-x   1 root root  112 Jul 27  2021 91-contract-ua-esm-status
-rwxr-xr-x   1 root root  374 Jul 17  2020 91-release-upgrade
-rwxr-xr-x   1 root root  165 Jul 21  2020 92-unattended-upgrades
-rwxr-xr-x   1 root root  129 May 14  2021 95-hwe-eol
-rwxr-xr-x   1 root root  111 Feb 25  2020 97-overlayroot
-rwxr-xr-x   1 root root  142 May 14  2021 98-fsck-at-reboot
-rwxr-xr-x   1 root root  144 May 14  2021 98-reboot-required

ファイルを追加してみる

ファイル追加後、実行権限追加

# cat << __EOM__ | tee /etc/update-motd.d/99-test
#!/bin/bash
echo 'test message: Hello World.'
__EOM__

# chmod +x /etc/update-motd.d/99-test

これでログインしてみると
「test message: Hello World.」が追加されている

$ ssh root@10.10.10.250
Warning: Permanently added '10.10.10.250' (RSA) to the list of known hosts.
Welcome to Ubuntu 20.04.3 LTS (GNU/Linux 5.4.0-125-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Wed 31 Aug 2022 06:38:26 AM UTC

  System load:  0.09               Processes:                142
  Usage of /:   27.4% of 23.45GB   Users logged in:          1
  Memory usage: 7%                 IPv4 address for docker0: 172.17.0.1
  Swap usage:   0%                 IPv4 address for enp1s0:  10.10.10.250


75 updates can be applied immediately.
To see these additional updates run: apt list --upgradable

New release '22.04.1 LTS' available.
Run 'do-release-upgrade' to upgrade to it.


test message: Hello World.
Last login: Wed Aug 31 06:37:08 2022 from 10.10.0.1
50_dialy/2022/08/31.txt · 最終更新: 2022/08/31 15:39 by matsui