Skip to main content
To display custom information to users after they log into an Ubuntu system via the console or SSH, you can use several standard approaches. The most common and effective methods are:
  • Using /etc/motd (Message of the Day)
  • Customizing shell profile files (.bashrc, .profile)
  • Creating system-wide scripts in /etc/profile.d/
This document explains each method in detail.

Method 1: Using /etc/motd (Message of the Day)

The /etc/motd file displays a message to users after successful login.

Step 1: Edit the /etc/motd File

Step 2: Add Custom Information

⚠️ Note:
/etc/motd does not evaluate shell commands.
Variables like $(hostname) will appear as plain text unless you use /etc/update-motd.d/ scripts.

Step 3: Save and Exit

Press Ctrl + X, then Y, and press Enter.

Method 2: Using Shell Profile Files (.bashrc / .profile)

Shell profile files allow you to run commands automatically when a user logs in.

Step 1: Edit Profile File

For a Specific User

For All Users (Global)

Step 2: Add Login Message Script

Best for:
  • Dynamic output
  • Per-user customization

Step 3: Save and Exit

Press Ctrl + X, then Y, and press Enter. Scripts placed in /etc/profile.d/ run automatically for all users during login.

Step 1: Create a Custom Script

Step 2: Add Script Content

Step 3: Make the Script Executable