Skip to main content

Introduction

The Message of the Day (MOTD) is a useful feature in Linux that displays a message to users upon logging into the system. This guide will show you how to create a custom MOTD script to display a personalized message and user login information.

Steps to Customize MOTD

1. Create a Custom MOTD Script

First, create a new script in the /etc/update-motd.d/ directory. This directory contains scripts that generate the MOTD.

2. Add Custom Content to the Script

Add the following content to the 99-custom script to display a welcome message, server URL, and recent user logins:
  • Example1
  • Example2

3. Save and Exit

Save the file and exit the text editor (Nano: press CTRL + X, then Y, then Enter).

4. Make the Script Executable

Change the permissions of the script to make it executable:

5. Test the MOTD Script

Run the run-parts command to test the new MOTD script:

6. Verify the Custom MOTD

You can view the content of your custom MOTD script with the cat command to ensure it is correct:

Example Output

When a user logs in, they will see the following message:

Conclusion

Customizing the MOTD in Linux is a simple yet effective way to convey important information to users upon login. By following these steps, you can create a personalized MOTD that enhances user experience and provides useful information about the system.
This guide includes detailed steps for creating and customizing the MOTD script, making it executable, and verifying its content. It also includes example output to illustrate what users will see upon login.