A custom MOTDsteemCreated with Sketch.

in #linux7 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

Sort:  

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!

Coin Marketplace

STEEM 0.20
TRX 0.24
JST 0.037
BTC 97001.71
ETH 3368.75
USDT 1.00
SBD 3.07