How To Customize Linux MOTD Screen On Popular Linux Distributions

Joseph Matino
How To Customize Linux Motd Screen On Popular Distributions

Whenever I set up a server, whether it’s for myself or for a client, one of the first things I like to do is personalize the Message of the Day (MOTD).

This is the message users see when they log into the system via a terminal or SSH. To me, the default message feels a bit impersonal. That’s why I always go for something that adds a bit of character.

In this article, I’ll walk you through how to customize the MOTD on your Linux server. I’ll cover the steps for AlmaLinux 8, Ubuntu (from version 20,04 up to the latest in 20.04), and Debian. It’s a simple process, but it can really enhance how users feel when they log in.

Personalizing the MOTD allows you to do more than just welcome users. You can provide useful information, system statistics, or even a bit of ASCII art for fun. It’s a small change, but it can significantly affect the overall user experience.

This guide is for anyone who wants their Linux server to offer a warmer welcome or convey essential information right at login.

By the end, you’ll have a MOTD that not only serves a practical purpose but also showcases a bit of your personality or your organization’s character.

What is the Login Message of the Day in Linux?

The login message of the day, or MOTD, in Linux, is a customizable message displayed to users upon login. It’s typically used to provide important information, announcements, or a personalized greeting.

The MOTD can be configured to display system statistics, user-specific messages, or even ASCII art. For example, a simple MOTD might look like this:

Welcome to Joseph Matino!
Today is: $(date)

This message greets users with a welcome note and displays the current date. System administrators can customize the MOTD to include any information they deem important for users to see upon logging in.

How To Create Custom MOTD Screen on AlmaLinux 8

on AlmaLinux 8, personalizing your server’s MOTD screen adds a unique touch to the user login experience.

This customization can include dynamic information, ASCII art, or a simple welcome message. Let’s explore how you can create a custom MOTD screen that reflects your style or provides useful information to users upon login.

Creating ASCII Art for Your MOTD

Enhancing your MOTD with ASCII art can make it more visually appealing. You can create ASCII art using various online generators. Here are a few options to get you started:

Steps to Customize Your MOTD on AlmaLinux 8

1. Create a New Script
Begin by creating a new script in the /etc/profile.d/ directory. This script will be executed when users log in.

sudo nano /etc/profile.d/slambo-motd.sh

2. Add Your Custom Message and ASCII Art
In the nano editor, you can add your personalized message and ASCII art. Here’s an example that includes a simple ASCII art representation of the word “SLAMBO”:

#!/bin/bash

# Define colors
GREEN='\033[0;32m'
NC='\033[0m' # No Color

# Print the welcome message and ASCII art
echo -e "${GREEN}Welcome to the SLAMBO Server!${NC}"
echo -e "${GREEN}Managed by Joseph Matino${NC}\n"
echo -e "${GREEN}"
cat << "EOF"
  _____ _               __  __ ____   ____    _______ _____ _____   _____ 
  / ____| |        /\   |  \/  |  _ \ / __ \  |__   __|_   _|  __ \ / ____|
 | (___ | |       /  \  | \  / | |_) | |  | |    | |    | | | |__) | (___  
  \___ \| |      / /\ \ | |\/| |  _ <| |  | |    | |    | | |  ___/ \___ \ 
  ____) | |____ / ____ \| |  | | |_) | |__| |    | |   _| |_| |     ____) |
 |_____/|______/_/    \_\_|  |_|____/ \____/     |_|  |_____|_|    |_____/ 
                                                                                                                                                      
EOF
echo -e "${NC}\n"

3. Save and Make the Script Executable
Save the script and make it executable to ensure it runs when users log in.

sudo chmod +x /etc/profile.d/slambo-motd.sh

4. Test Your New MOTD
Log out and log back in, or open a new terminal session, to see your custom MOTD with the ASCII art and personalized message.

By following these steps, you can create a custom MOTD screen in AlmaLinux 8 that welcomes users with a personalized message and creative ASCII art.

Feel free to modify the script to include additional information or different ASCII art designs to match your preferences.

How To Create Custom MOTD Screen on Ubuntu (20.04 to 23.04)

For Ubuntu users, personalizing the MOTD screen can add a welcoming touch to your server. on Ubuntu, the MOTD is managed by a collection of scripts in the /etc/update-motd.d/ directory. Here’s how you can create a custom MOTD for Ubuntu versions 20.04 to 23.04.

1. Navigate to the MOTD Scripts Directory
Start by navigating to the directory where the MOTD scripts are stored.

cd /etc/update-motd.d/

2. Disable Existing MOTD Scripts (Optional)
If you want to start with a clean slate, you can disable the existing MOTD scripts by renaming them with a .disabled extension. For example:

sudo mv 00-header 00-header.disabled
sudo mv 10-help-text 10-help-text.disabled

3. Create a New MOTD Script
Create a new script that will display your custom MOTD message.

sudo nano slambo-custom-motd

4. Add Your Custom MOTD Content
In the nano editor, add your personalized message and any ASCII art you want to include. Here’s a simple example:

#!/bin/bash

# Define colors
GREEN='\033[0;32m'
NC='\033[0m' # No Color

# Print the welcome message and ASCII art
echo -e "${GREEN}Welcome to the SLAMBO Server!${NC}"
echo -e "${GREEN}Managed by Slambo Tips${NC}\n"
echo -e "${GREEN}"
cat << "EOF"

                                                     .-'''-.     
                                                    '   _    \   
 __  __   ___                     .--.   _..._    /   /` '.   \  
|  |/  `.'   `.                   |__| .'     '. .   |     \  '  
|   .-.  .-.   '              .|  .--..   .-.   .|   '      |  ' 
|  |  |  |  |  |    __      .' |_ |  ||  '   '  |\    \     / /  
|  |  |  |  |  | .:--.'.  .'     ||  ||  |   |  | `.   ` ..' /   
|  |  |  |  |  |/ |   \ |'--.  .-'|  ||  |   |  |    '-...-'`    
|  |  |  |  |  |`" __ | |   |  |  |  ||  |   |  |                
|__|  |__|  |__| .'.''| |   |  |  |__||  |   |  |                
                / /   | |_  |  '.'    |  |   |  |                
                \ \._,\ '/  |   /     |  |   |  |                
                 `--'  `"   `'-'      '--'   '--'                

                                                                                                                                                      
EOF
echo -e "${NC}\n"

5. Save and Make the Script Executable
Save the script and make it executable so it runs when users log in.

sudo chmod +x slambo-custom-motd

6. Test Your New MOTD
To see your custom MOTD, log out and log back in, or open a new terminal session. You should see your personalized message displayed.

By following these steps, you can customize the MOTD screen in Ubuntu to reflect your personality or provide useful information to users upon login. This simple customization can enhance the user experience and make your server feel more welcoming.

How To Create Custom MOTD Screen on Debian

Personalizing the MOTD screen on Debian can add a welcoming touch to your server. Here’s how to create a custom MOTD that includes both dynamic information and a static message.

1. Create a New Script for Dynamic MOTD Content
Start by creating a new script in the /etc/profile.d/ directory. This script will generate dynamic content for your MOTD.

sudo nano /etc/profile.d/custom-motd.sh

2. Add Script Content for Dynamic Information
In the nano editor, add the following content to display dynamic system information and a personalized message. This example includes a simple ASCII art logo.

#!/bin/bash

# System information variables
HOSTNAME=$(hostname)
DATE=$(date +"%A, %d %B %Y")
KERNEL=$(uname -r)
UPTIME=$(uptime -p)
USERS=$(who | wc -l)

# ASCII art logo
echo "Welcome to Debian Server - Managed by Slambo Tips"
echo "  ____  _____  _    _ _______        _____ _______ "
echo " |  _ \|  __ \| |  | |__   __|/\    / ____|__   __|"
echo " | |_) | |  | | |  | |  | |  /  \  | (___    | |   "
echo " |  _ <| |  | | |  | |  | | / /\ \  \___ \   | |   "
echo " | |_) | |__| | |__| |  | |/ ____ \ ____) |  | |   "
echo " |____/|_____/ \____/   |_/_/    \_\_____/   |_|   "

# Display system information
echo "Hostname    : $HOSTNAME"
echo "Date        : $DATE"
echo "Kernel      : $KERNEL"
echo "Uptime      : $UPTIME"
echo "Users Online: $USERS"
echo "Enjoy your session!"

3. Save and Make the Script Executable
Save the script and make it executable to ensure it runs when users log in.

sudo chmod +x /etc/profile.d/custom-motd.sh

4. Create a Static MOTD File (Optional)
If you want to include static content in your MOTD, you can create or edit the /etc/motd file.

sudo nano /etc/motd

Add any static content you want to display, such as a welcome message or contact information.

5. Test Your New MOTD
Log out and log back in, or open a new terminal session, to see your custom MOTD with both dynamic and static content.

By following these steps, you can create a personalized MOTD screen on Debian that provides useful system information and a warm welcome to users.

This customization enhances the user experience and makes your server more informative for users, particularly those new to Linux.

What is the MOTD File Format?

The MOTD file format in Linux is typically plain text, allowing for easy editing and customization. The file is usually located at /etc/motd and can be modified using any text editor.

The content of the MOTD file is displayed to users after they log in. Here’s an example of a simple MOTD file content:

Welcome to Slambo Tips Website!
Please remember to log out when you're done.

This MOTD file contains a welcome message and a reminder for users to log out after their session. Administrators can add or modify the content of this file to change the message displayed to users upon login.

What is the Message of the Day in SSH?

The message of the day in SSH is similar to the MOTD in a regular Linux login. It’s displayed to users when they connect to a server via SSH. This message can be customized to provide information or warnings to users accessing the server remotely.

For example, an SSH MOTD might include a warning about unauthorized access:

WARNING: Unauthorized access to this server is prohibited.
All activities are monitored and recorded.

This message serves as a warning to users that their actions are being monitored and that unauthorized access is not allowed.

Wrapping Up

The message of the day (MOTD) in Linux is a versatile tool for system administrators to communicate important information to users upon login. Whether it’s through a local login or an SSH connection, the MOTD can be customized to include greetings, warnings, system information, or any other message deemed necessary.

By understanding how to configure and customize the MOTD, administrators can enhance the user experience and ensure that important information is conveyed effectively.

Share This Article
Leave a comment