The Message Of The Day displayed on shell login is generated from
- output of executable scripts in
/etc/update-motd.d
- contents of
/etc/motd
- last ssh login
# create script for welcome message
cd /etc/update-motd.d
sudo touch 00-welcome
sudo chmod +x 00-welcome
sudo nano 00-welcome
# install toilet for ascii text display
sudo apt-get update
sudo apt-get install -y toilet
#!/bin/bash
echo ""
# display ascii art with hostname
toilet --termwidth --filter border --gay --font future -k "$HOSTNAME"
echo ""
# display device model
echo "$(tr -d "\0" < /proc/device-tree/model)"
# display distribution name
echo "$(lsb_release -ds)"
# display kernel version
echo "$(uname -srm)"
echo ""
# display cpu/mem usage
cpuUsage=$(top -bn1 | awk '/Cpu/{printf "%d%%", $2}')
memUsage=$(free -m | awk '/Mem:/{printf "%.0f%% (%dM/%dM)", ($3/$2*100), $3, $2}')
echo "CPU Usage: $cpuUsage"
echo "Memory Usage: $memUsage"
# display disk usage
diskUsage="$(df -h --total | grep -E "^total")"
du=($diskUsage)
echo "Disk Usage: ${du[4]} (${du[2]}/${du[1]})"
echo ""
# display date and time
date "+%A, %e. %B %Y%n%T"
echo ""
Set PrintLastLog no
in /etc/ssh/sshd_config
.
Restart sshd with sudo systemctl restart ssh.service
.