There are now all kinds of options to give your RaspberryPi a personal touch. From self-designed and then 3D printed housings to self-soldered expansion boards, there is actually almost nothing that is not possible.
On the software side, too, there are all sorts of options to customize the appearance and functions as you see fit. One option is to set up a personal login screen - i.e. the first message you see after logging in.
How you set up this “Message of the Day” (the actual name of the view at the beginning of the login screen) is explained in the following article.
Safety instructions
I know the following notes are always kind of annoying and seem unnecessary. Unfortunately, many people who knew "better" have lost eyes, fingers or other things due to carelessness or injured themselves. Data loss is almost negligible in comparison, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth injury or other trouble.
https://www.nerdiy.de/sicherheitshinweise/
Affiliate links/advertising links
The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and make a purchase via this link, Nerdiy.de will receive a commission from the relevant online shop or provider. The price does not change for you. If you make your purchases via these links, you support Nerdiy.de in being able to offer other useful projects in the future. 🙂
Requirements
Helpful articles:
So that you can edit the “Message of the Day” on your Raspberry Pi, it should of course be prepared so that you can access it via SSH.
The following three articles describe what needs to be done to prepare the RaspberryPi:
RaspberryPi – setup for nerdiys!
RaspberryPi – The first configuration!
RaspberryPi – Control the RaspberryPi via SSH
Required tool:
-no-
Required material:
In the following list you will find all the parts you need to implement this article.
Log in to the RaspberryPi via SSH
To start, you must first log in to the Rasp Pi with Putty via SSH. How to do this is in the article RaspberryPi - Control the RaspberryPi via SSH described.
Create a “Message of the Day” file
First you have to create the message you want to display. To do this, create a directory - in which the file will later be created - with the following command:
sudo mkdir ~/motd
...and then creates the file to be displayed:
sudo nano ~/motd/mymotd
There you now insert the welcome message that you want to display.
You are welcome to use the example below.
#!/bin/bash PROCCOUNT=`ps -l | wc -l` PROCCOUNT=`expr $PROCCOUNT - 4` if [[ $(groups) == *irc* ]]; then ENDPROC=`cat /etc/security/limits.conf | grep "@irc" | grep nproc | awk {'print $4'}` ENDSESSION=`cat /etc/security/limits.conf | grep "@irc" | grep maxlogins | awk {'print $4'}` PRIVLAGED="IRC Account" else ENDPROC=`cat /etc/security/limits.conf | grep "*" | grep nproc | awk {'print $4'}` ENDSESSION="Unlimited" PRIVLAGED="Regular User" fi echo -e "33[1;32m __ __ _ / / | | / / /__| | ___ ___ _ __ ___ ___ / / / _ |/ __/ _ | _ _ / _ \ \ / / __/ | (_| (_) | | | | | | __/ / / \___|_|\___\___/|_| | _| |_|\___| 33[0;37m +++++++++++++++++: System Data :++++++++++++++++ ++++ + Hostname: `hostname` + IP address: `hostname -I` + Kernel: `uname -r` + Free Space: `df -h / | awk -v col=4 'NR > 1 {sub ( "%", "", $col); print $col }'` + Memory: `cat /proc/meminfo | grep MemTotal | awk {'print $2'}` kB + Uptime:`uptime | sed 's/.* up ([^,]*), .*/1/'` ++++++++++++++++++: User Data :++++++++++++ ++++++++ + Username: `whoami` + Privlages = $PRIVLAGED + Last login: `lastlog | grep pi | awk {'print $4,$5$6,$7,$8,$9'}` + Sessions: `who | grep $USER | wc -l` of $ENDSESSION MAX + Processes: $PROCCOUNT of $ENDPROC MAX +++++++++++++++++++++++++++++++++++ ++++++++++++++++++ "
Now you have to make the file executable. This can be done with the following command:
sudo chmod +x ~/motd/mymotd
Disable static “Message of the Day”.
In order for the welcome message you just set to be displayed, you have to deactivate the old message - which is set up “at the factory” on every Raspberry Pi. To do this, open the file:
sudo nano /etc/ssh/sshd_config
Edit PAM configuration
Now you have to edit your PAM configuration. To do this, open the file:
sudo nano /etc/pam.d/login
“session optional pam_motd.so noupdate” “session optional pam_motd.so motd=/run/motd.dynamic”
edit profile
In the last step you have to specify that you want your new welcome message to be displayed when you start.
To do this, open the file:
sudo nano /etc/profile
/home/pi/motd/mymotd
Perform a restart
In order for this new file to be adopted - and to test the whole thing - you can restart with
sudo reboot
The output doesn't work :/ – What to do?
If you get an error message after booting up instead of the welcome message, then this is most likely due to the formatting of the myotd file being mixed up.
The problem with formatting is that your RaspberryPi may interpret what is written differently than it is presented to you.
To fix this you have to open the file again:
sudo nano ~/motd/mymotd
Now you have to edit the file so that it looks exactly like the photo below.
In order to be able to test your changed file - without having to restart every time, you can also enter the following command (if you are in the motd folder):
./myotd
With the example “Message of the Day” given above, you will also be shown some current system data. Immediately after logging in, you can see what the resource utilization on your Raspberry Pi looks like and react if necessary.
Have fun with the project
I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are always welcome. 🙂
PS Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you think it's cool that I share the information with you, I would be happy about a small donation to the coffee fund. 🙂