Prerequisites
Before setting up MOTD, make sure you have:
- SSH access to your VPS
- Root or sudo privileges (to modify system files)
What is MOTD?
MOTD (Message of the Day) is the text displayed immediately after you log in via SSH. It can show system status, warnings, or custom messages.
Method 1: Simple MOTD (Static Message)
Connect to your VPS:
ssh hxroot@YOUR_SERVER_IP -p 22
sudo nano /etc/motd
Add your message:
============================================
Welcome to Hostxpeed VPS
Hostname: web01.example.com
IP Address: 148.113.173.106
============================================
All connections are monitored.
Unauthorized access is prohibited.
============================================
Save and exit. Next SSH login will show this message.
Method 2: Dynamic MOTD with System Information (Ubuntu/Debian)
Ubuntu uses scripts in /etc/update-motd.d/. Disable default scripts and add your own.
First, make default scripts non-executable:
sudo chmod -x /etc/update-motd.d/*
Create custom script:
sudo nano /etc/update-motd.d/99-custom-motd
Add content:
#!/bin/bash
echo "============================"
echo " Hostxpeed VPS Status"
echo "============================"
echo " Hostname: $(hostname)"
echo " Uptime: $(uptime -p)"
echo " Load: $(uptime | awk -F 'load average:' '{print $2}')"
echo " Memory: $(free -h | awk '^Mem: {print $3"/"$2}')"
echo " Disk: $(df -h / | awk 'NR==2 {print $3"/"$2 " ("$5")"')"
echo " Logins: $(who | wc -l) user(s) currently logged in"
echo "============================"
Make executable:
sudo chmod +x /etc/update-motd.d/99-custom-motd
Test:
run-parts /etc/update-motd.d/
Method 3: MOTD for All Users via /etc/profile
sudo nano /etc/profile.d/motd.sh
Add:
#!/bin/bash
if [ "$TERM" != "dumb" ] && [ -z "$MOTD_SHOWN" ]; then
echo "Welcome, $USER"
echo "Server: $(hostname)"
echo "Date: $(date)"
export MOTD_SHOWN=1
fi
Make executable:
sudo chmod +x /etc/profile.d/motd.sh
Method 4: Systemd-based MOTD (Modern)
Create a systemd service to generate dynamic MOTD on boot.
Create script:
sudo nano /usr/local/bin/generate-motd
Add dynamic content, then create service file to run it.
Disable Default MOTD
To clear default messages, empty the motd file:
sudo truncate -s 0 /etc/motd
Or remove executable permissions from update-motd.d scripts.
✅ Custom MOTD configured. Your users will see it on every SSH login.