A custom MOTDsteemCreated with Sketch.

in linux •  7 years ago  (edited)

A Personal MOTD

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
A custom MOTD: code
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
A custom MOTD: bash
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

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

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:

SteemFest3 and SteemitBoard - Meet the Steemians Contest

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @lucasalt! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

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:

SteemFest Meet The Stemians Contest - The mysterious rule revealed
Vote for @Steemitboard as a witness to get one more award and increased upvotes!