- Using
/etc/motd(Message of the Day) - Customizing shell profile files (
.bashrc,.profile) - Creating system-wide scripts in
/etc/profile.d/
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/motddoes 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
PressCtrl + 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
PressCtrl + X, then Y, and press Enter.
Method 3: Using a Custom Script in /etc/profile.d/ (Recommended)
Scripts placed in /etc/profile.d/ run automatically for all users during login.