How to customize the MOTD on Ubuntu
Supported targets: Ubuntu 22.04 and 24.04. The
update-motd.dframework ships built-in viabase-filesandpam_motd. Other distros use different mechanisms.
Install the rendering tools
sudo apt update
sudo apt install -y figlet lolcat fortune cowsay
Create the MOTD script
sudo nano /etc/update-motd.d/99-motd
Add the script
#!/bin/bash
/usr/bin/figlet <your-banner-text> | /usr/games/lolcat -f
echo "Welcome back, $USER!"
echo "========================================"
echo "Date: $(date)"
echo "System $(uname -a | awk '{print $1, $3}')"
echo "========================================"
/usr/games/fortune | /usr/games/cowsay -f tux | /usr/games/lolcat -f
Make it executable
sudo chmod +x /etc/update-motd.d/99-motd
Preview without logging out
run-parts /etc/update-motd.d/
Disable a stock MOTD fragment by removing its executable bit:
sudo chmod -x /etc/update-motd.d/10-help-text. Files run in lexical order, so a99-prefix runs last.
References: