Difference between revisions of "Linux MOTD"
(Created page with "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 mac...") |
|||
(7 intermediate revisions by the same user not shown) | |||
Line 5: | 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 == | ||
In Ubuntu you can edit the message of the day with: | In Ubuntu you can edit the message of the day with: | ||
− | nano /etc/update-motd.d/00-header | + | sudo nano /etc/update-motd.d/00-header |
At the bottom of this file I usually insert the following lines: | At the bottom of this file I usually insert the following lines: | ||
Line 27: | Line 28: | ||
sudo rm /etc/update-motd.d/80-livepatch | sudo rm /etc/update-motd.d/80-livepatch | ||
+ | Once you have done this then log out, then log in. | ||
+ | |||
+ | [[File:neofetch_raspian.png|right|600px|thumbnail| I like to make my login screen as useful as possible]] | ||
== Raspbian == | == Raspbian == | ||
Line 44: | Line 48: | ||
Provide execute permissions | Provide execute permissions | ||
− | chmod 755 /bin/motd-script | + | sudo chmod 755 /bin/motd-script |
Then edit crontab | Then edit crontab | ||
− | + | sudo nano /etc/crontab | |
I then inserted the following line to use the script to update the motd | I then inserted the following line to use the script to update the motd |
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