Translated from French with Deepl
Original post (in french)
Today, we are going to modify the MOTD that appears when we connect SSH to our server. Generally, it gives you some general information about your machine. You can display the server's uptime, RAM consumption,...
Personally, I did something simple. It only displays me a logo and text.
To make a custom MOTD, there are many different ways to do it. Personally, I chose the method where we write a basic script that we execute so that it can edit the `/etc/motd' file alone.
Writing the script
As said above, I wrote a small script (koff, koff,... it's internet that wrote it for me) that I saved in a file raspi-motd.sh
. If you want the same MOTD as I do, you can find the code here: https://gist.github.com/piksel/3023588
I slightly modified the script as explained in the comments below. You just have to change the line 20 echo "$logo" > /etc/motd.tail
to echo "$logo" > /etc/motd
.
Then I saved the file and executed it. Being a beginner with Linux, I had a little trouble running the file. Finally, two solutions are offered to me. Either:
Allow the script to run,
run it with bash /path/to/script.sh
command
I first chose the first option (hehey I said I didn't understand anything) and then I thought it was time to try the second one anyway. (spoiler! The second one is faster)
First solution:
chmod +x raspi-motd.sh
gives the script execution rights
raspi-motd.sh
script is executed
Second solution
bash raspi-motd.sh
simply execute the script
Unfortunately, I have a small error, because it doesn't find the bootlogs
file in /etc/init.d/
but no worries it still works. Finally, all you need to do is reconnect and the custom MOTD will appear.
Sources:
L4p1n's blog
Source code
How to run. sh file
Images:
By myself
Congratulations @lucasalt! You have received a personal award!
1 Year on Steemit
Click on the badge to view your Board of Honor.
Do not miss the last post from @steemitboard:
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations @lucasalt! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Do not miss the last post from @steemitboard:
Vote for @Steemitboard as a witness to get one more award and increased upvotes!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit