Add a dynamic MOTD to your Linux server

Add a dynamic MOTD to your Linux server

Setting up a MOTD on your server adds a nice touch that welcomes you warmly every time you connect to it.

I used to make my own MOTD in ASCII text, but I've been using dynamic-motd by ldidry for a few years.

It's simple Bash and Python scripts that are executed in place of the MOTD. It seems they are only compatible with Debian-based distributions, though.

It's very easy to setup.

First install dependencies:

apt-get install figlet lsb-release python-utmp bc

Then clone the repository and copy the files:

git clone https://github.com/ldidry/dynamic-motd.git
cd dynamic-motd
cp -r update-motd.d/ /etc
rm /etc/motd
ln -s /var/run/motd /etc/motd
cd ..
rm -r dynamic-motd

You lookup the files in /etc/update-motd.d:

root@lyra ~# ll /etc/update-motd.d/
total 36K
-rwxr-xr-x 1 root root 113 Jul 5 2017 00-figlet*
-rwxr-xr-x 1 root root 1.6K Jul 5 2017 10-banner*
-rwxr-xr-x 1 root root 374 Jul 5 2017 20-system-info*
-rwxr-xr-x 1 root root 505 Jul 5 2017 30-need-upgrade*
-rwxr-xr-x 1 root root 396 Jul 5 2017 40-need-reboot*
-rwxr-xr-x 1 root root 358 Jul 5 2017 50-services-need-restart*
-rw-r--r-- 1 root root 174 Jul 5 2017 colors
-rw-r--r-- 1 root root 107 Feb 6 10:24 lsb-release
-rw-r--r-- 1 root root 2.9K Jul 5 2017 sysinfo.py

Reconnect to your server, and there you have it!

dynamic-motd

You have the main information of your server, plus the hostname written in a nice red ASCII style.

Stanislas
Author
Stanislas
I like building things with code and computers

Comments

1Atom feed
Markdown supported
  1. Jip

    in 2023 are 3 changes :)

    1:

    Old: apt-get install figlet lsb-release python-utmp bc

    New: apt-get install figlet lsb-release python3-utmp bc

    2:

    Old:ln -s /var/run/motd /etc/motd

    New: now is it not necessery to create symlink. Linux (debian) uses dynamic motd /var/run/motd.dynamic

    3:

    edit /etc/update-motd.d/20-system-info and change line 13

    python /etc/update-motd.d/sysinfo.py

    to

    python3 /etc/update-motd.d/sysinfo.py