unix

How do I update the MOTD on an AWS EC2 Linux server?

When logging into an AWS Linux server you will see a default MOTD (message of the day) that looks like the example below:

Last login: Mon Nov 9 12:02:10 2020 from 000.000.000.000

__| __|_ )
_| ( / Amazon Linux AMI
___|\___|___|

https://aws.amazon.com/amazon-linux-ami/2018.03-release-notes/

12 package(s) needed for security, out of 26 available
Run “sudo yum update” to apply all updates.

This message is typically located in the file /etc/motd, however in Amazon Linux it is a symlink to /var/lib/update-motd/motd. It is dynamically updated by running /usr/sbin/update-motd in a cronjob /etc/cron.d/update-motd. If you attempt to update /etc/motd it will be overwritten when the cron job runs.

To change the MOTD on you Amazon Linux, simply update an existing script in /etc/update-motd.d/ or create a new one. The scripts will be executed in alphabetical order and the final MOTD will be the concatenation of the output of all the scripts.

Ex.

30-banner
70-available-updates
75-system-update

Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

To Top