All the work below is my customisation of motd from the forum thread on raspberrypi.org
Written in bash and tested with the Raspbian distribution.
- Create file
motd.sh
in/etc
sudo nano /etc/motd.sh
Use one of the 2 different motd layout to fill this file.
- Change owner and make it executable:
sudo chown root:root /etc/motd.sh && sudo chmod +x /etc/motd.sh
-
Add
/etc/motd.sh
as the last line in your~/.profile
to execute the script when the user logs in via a tty console or ssh. -
Remove the original motd file:
sudo rm /etc/motd
You can remove the "last login" information. However it is considered a security risk. If you wish to do so, you should disable the PrintLastLog
option from the sshd
service. Edit the /etc/ssh/sshd_config
file and uncomment the line #PrintLastLog yes
:
sudo nano /etc/ssh/sshd_config
Before:
#PrintLastLog yes
After:
PrintLastLog no
Restart the sshd
service:
sudo /etc/init.d ssh restart
Now simply SSH into the Pi and enjoy the new motd.
Note: If you don't see the degree Celsius character correctly (º
) make sure you have enabled a UTF8 locale.
motd2.sh
is copied from Retropie (Replaced Joystick with Raspberry Logo).
The ASCII logo came from a forum thread on raspberrypi.org
Auto installation:
git clone https://github.com/yoannportugal/raspberry-pi-motd
sudo chown root:root /home/pi/raspberry-pi-motd/install-motd/install-motd && sudo chmod +x /home/pi/raspberry-pi-motd/install-motd/install-motd
sudo sh /home/pi/raspberry-pi-motd/install-motd/install-motd
cd /raspberry-pi-motd/install-motd
sudo sh install-motd
sudo echo "/etc/motd.sh" >> ~/.profile
rm -R /home/pi/raspberry-pi-motd