motd Info generates a dynamic motd via shell scripts. It is easily configurable.
motd Info follows the following principles:
- information is displayed with as little characters as possible while still easily readable
- this also means having sufficient blank space inbetween
- bad values stand out more than good ones
- dates are ISO-8601
- times specify the time zone
- Copy this folder to
/usr/local/src/motd-info/. Perhaps exclude.gitand similar. The target folder does not have to be owned by root. (Target location as per the Filesystem Hierarchy Standard.)- SCP to server:
rsync -a --delete --exclude={".git",".gitignore",".shellcheckrc","example.txt","example.png"} --info=progress2 . user@server:/usr/local/src/motd-info
- SCP to server:
- create a symlink to the
generate.shscript in theupdate-motd.ddirectory:
sudo ln -s /usr/local/src/motd-info/generate.sh /etc/update-motd.d/09-motd-info - check the static part of the motd in
/etc/motd, remove unwanted parts (probably everyting, i.e. empty (not delete) the file) - check what other motd scripts are in
/etc/update-motd.d/and delete the unwanted ones (probably all) - configure
config.txtto change the layout - configure widgets
- if using lastlogins widget (default):
- Disable sshd's last login prompt by setting the
PrintLastLogflag tonoin/etc/ssh/sshd_config(detailed implications explained below). Restart sshd withsudo systemctl restart sshd. - Unfortunately, there is no elegant way to remove the last login prompt on physical/virtual terminals (
~/.hushloginalso hides motd).
- Disable sshd's last login prompt by setting the
- (optional) add a link into your home directory to always have access to the info:
ln -s /usr/local/src/motd-info/generate.sh ~/motd-info
Check the widget files for config options.
This chapter does not list all widgets, only ones that require special attention.
You may want to install needsrestart to be notified of required restarts due to library upgrades. Check the widget for more info.
If you want to use the lastlogin widget:
- lastlogins shows a list of the N most recently logged in users. This does not necessarily include you.
- This is because motd is user agnostic.
- motd may be pregenerated and cached, hence the info may be stale.
- Disable sshd's last login prompt by setting the
PrintLastLogflag tonoin/etc/ssh/sshd_config.
lastexec may be useful on systems where motd is cached (e.g. Ubuntu) to see how old the information is.
- test in motd environment:
/usr/bin/env -i PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin ./generate.sh- actual motd environment is run as root
- execute all system motd scripts:
run-parts --lsbsysinit /etc/update-motd.d - execute all system motd scripts in motd environment:
/usr/bin/env -i PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin run-parts --lsbsysinit /etc/update-motd.d- actual motd environment is run as root
(taken from Stack Overflow)
The motd displayed at login may not be up to date. Depending on the system, it is pre-generated and then cached for a while.
Ubuntu caches it. Proxmox does not. Any others I don't know.
The script (or symlink) in /etc/update-motd.d/ must have a filename that satisfies:
- starting with a two digit number: dd-xxxxxx
- only lower-case letters, digits, '-', '_'
- no extension (as '.' is not allowed), no caps, 00-xxxxxxx
Check whether your script would run (outputs list of all scripts that would run without running them):
run-parts --test --lsbsysinit /etc/update-motd.d
This motd was inspired by BDR's tinymod.
Other informational motd:
- tinymotd by BDR
- ssh-motd by Rob Walsh
- dynamic-motd by Luc Didry
- proxmox-motd by Kevin Vo
See motd.md.
