Difference between revisions of "Linux MOTD"
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
I like to make my message of the day as useful as possible. When I login via ssh I want it to be really clear as to which machine I am using and the specifications of that machine. The way that you do this varies between different distributions. Below are some examples of Ubuntu and Rasbian. | I like to make my message of the day as useful as possible. When I login via ssh I want it to be really clear as to which machine I am using and the specifications of that machine. The way that you do this varies between different distributions. Below are some examples of Ubuntu and Rasbian. | ||
Line 7: | Line 5: | ||
sudo apt install figlet neofetch | sudo apt install figlet neofetch | ||
+ | [[File:neofetch.png|right|400px|thumbnail| I like to make my login screen as useful as possible]] | ||
== Ubuntu == | == Ubuntu == | ||
Latest revision as of 07:01, 9 June 2020
I like to make my message of the day as useful as possible. When I login via ssh I want it to be really clear as to which machine I am using and the specifications of that machine. The way that you do this varies between different distributions. Below are some examples of Ubuntu and Rasbian.
There are a couple of packages that I like. You can install them with:
sudo apt install figlet neofetch
Ubuntu
In Ubuntu you can edit the message of the day with:
sudo nano /etc/update-motd.d/00-header
At the bottom of this file I usually insert the following lines:
figlet -f small Welcome to [Insert_server_name_here] neofetch
I usually then explore the other parts that are added by subsequent files in /etc/update-motd.d/ if I don' find the other information useful then I just delete.
As an example, on my amazon EC2 machine I did:
sudo rm /etc/update-motd.d/10-help-text sudo rm /etc/update-motd.d/50-landscape-sysinfo sudo rm /etc/update-motd.d/50-motd-news sudo rm /etc/update-motd.d/51-cloudguest sudo rm /etc/update-motd.d/80-esm sudo rm /etc/update-motd.d/80-livepatch
Once you have done this then log out, then log in.
Raspbian
Raspbian does not feature a dynamic message of the day. It will simply read and print whatever the contents of /etc/motd. This means that you will need to use cron to periodically insert the data into the motd. Make sure you have installed the packages above.
Then you want to create a script
nano /bin/motd-script
#!/bin/bash figlet -f small Welcome to Raspbian neofetch
Provide execute permissions
sudo chmod 755 /bin/motd-script
Then edit crontab
sudo nano /etc/crontab
I then inserted the following line to use the script to update the motd
24 * * * * root /bin/motd-script > /etc/motd
Other
Sometimes I like running:
/usr/games/cowsay -f /usr/share/cowsay/cows/default.cow Hello, $(w -h | awk '{print $1"@"$3}') I am $HOSTNAME