Customized dynamic message of the day (motd) for Raspberry Pi (Original Repo: https://github.com/ar51an/raspberrypi-motd)
Many folks use Raspberry Pi as headless. If you use SSH more often to connect Raspberry Pi and interested in changing the MOTD (message of the day), keep on reading. The goal is to create simple, swift and useful motd.
The goal of this fork is to simplify the MOTD display and add a touch of visual flair. I removed the update count out of personal preference and replaced it with a stylized ASCII Raspberry Pi logo. If your still interested in displaying the update count I would definitely recommend taking a look at ar51an's repo, he did a great job.
The process used for the motd is the same as RaspiOS or Ubuntu uses to show the motd dynamically. There is no additional package or third party tool used. It is written in bash and executes using the same mechanism as the default motd. There are multiple commands for retrieving the same information. This dynamic motd takes approximately 1 sec after authentication. This is the fastest you can get with all the information it is displaying.
HW OS Raspberry Pi 5 Model Braspios-bookworm-arm64
-
Delete
/etc/motd. This file contains the static text about Debian GNU/Linux liability. Alternatively you can keep a backup of this file at some place.sudo rm /etc/motd -
Delete
/etc/update-motd.d/10-uname. This file prints the OS version dynamically to the default message. New motd will print a trimmed down version of OS.sudo rm /etc/update-motd.d/10-uname -
Modify
/etc/ssh/sshd_config. This file prints last login timestamp and location. New motd will print last login timestamp and location.sudo nano /etc/ssh/sshd_config
Add:PrintLastLog no
Save & Exit
Restart sshd:sudo systemctl restart sshd
NOTE:
Default motd is completely removed. Reconnect ssh session and if you followed the steps correctly you will not see any motd.
-
Copy
10-welcomeand15-systemscripts from the latest release underupdate-motd.ddir to/etc/update-motd.ddir. Make sure scripts are under the ownership of root and are executable.Change ownership [If needed]:
sudo chown root:root /etc/update-motd.d/<script-name>Make scripts executable [If needed]:
sudo chmod +x /etc/update-motd.d/<script-name>
NOTE:
Let's test new motd to verify that everything is working properly. Either reconnect ssh session or run the new motd from the same shell. If steps were followed correctly you will see new motd, something similar to the preview.Run motd from the same shell:
sudo run-parts /etc/update-motd.d
Displays the raspberry model, welcome user message, current timestamp and kernel version.
Shows various details of the system. It includes temperature, memory, running processes and others. Few labels are trimmed down, like
ProcsforProcesses,TempforTemperature,LastforLast Login. You can use full labels according to your preference and arrange them accordingly.
