Here is How You Can Make The SSH Welcome Colorful, Known as Message of the Day or MOTD on Ubuntu Server on Rackspace Cloud in Simple Way. This Colorful SSH Welcome Message has specific terminology – SSH Banner. We already know the basics to change SSH welcome message from our previous guide, this time we will modify it further to get colorful one!
Information Around Colorful SSH Welcome Message aka MOTD Banner
There are some theoretical stuffs like when we run the command ssh root@ip_address
, when a ssh session is connected and before the authorization till we are providing the password and successfully getting login to the server, it is handled by another daemon. After we successfully pass the password authentication, what we get usually we refer to SSH Welcome Message or Message of the Day (MOTD). We are talking about MOTD part only.
Colorful MOTD Banner was once very popular! Even the high end computer and networking equipment manufacturers used to have their official tutorials. Cisco switches has dedicated banner motd
command. As with the increased usage of Cloud Servers has made the usage of SSH necessary again, many users are finding resources to customize them.
---
In the previous guide linked above, frankly we have edited one file in the /etc/update-motd.d
to change the SSH Welcome Message. If we edited the file /etc/issue.net
and do some change we would get things before. root@IP_address's password:
– this is usually disabled on all GNU Linux! In order to change this, we need to first open the file /etc/issue.net
and put things we like (it is Server Version as text by default) and save it. Then we need to open /etc/ssh/sshd_config
and find out the commented out line Banner /etc/issue.net
, make it active by removing that hash, save it and doing ssh daemon’s restart by running the command sudo service ssh restar
.
If you ask on most those question, answer forums; most will be unable to tell you things “before the authorization till we are providing the password”. They do not know the basics. See this screenshot, my one server nicely giving warning :
We are explaining the commands under different sub headers.
Changing The Message Before The True SSH Welcome Message aka MOTD Banner
This is what we described above and usually people do not know and is disabled by default. Legally this is important! In “Computer Misuse Act 1990” it has been strongly recommended that the computers must display a banner before asking the users to log in! The Act stipulates that an offense of unauthorized access can only be committed if the offender knew at the time that the access he intended to obtain was unauthorized! Quite funny, this is kind of hanging a banner “Trespassers Will Be prosecuted”! So, here we go :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # login as root nano /etc/ssh/sshd_config # find the phrase # Banner /etc/issue.net # with O + W # remove that hash before it and save the file with # ^ + O and exit with ^ + X nano /etc/issue.net # remove the default Ubuntu version text # copy paste things which is kind of "Trespassers Will Be prosecuted" # you can copy it : ******************************************************************** * * * This system is for the use of authorized users only. Usage of * * this system may be monitored and recorded by system personnel. * * * * Anyone using this system expressly consents to such monitoring * * and is advised that if such monitoring reveals possible * * evidence of criminal activity, system personnel may provide the * * evidence from such monitoring to law enforcement officials. * * * ******************************************************************** # restart sshd sudo service ssh restart # or /etc/init.d/sshd restart # exit and login exit && ssh root@your-IP # never combined exit and login to ssh before? lol |
Colorful SSH Welcome Message (Ubuntu, Rackspace Cloud)
Now after login, i.e. shooting the trespassers! So basically this is advanced usage of change SSH welcome message.
While I know many methods, for this only color part, easiest is to use lolcat – it is a ruby package :
1 | https://github.com/busyloop/lolcat |
We can install quite easily on Ubuntu :
1 | apt-get install lolcat |
Now run :
1 | lolcat -h |
to see rainbow. Here your piping comes in work; try these commands :
1 2 3 4 5 | ls # versus ls | lolcat # versus ls | lolcat -a |
Yeah yeah, animated colorful stuffs with the full command. Now install these :
1 | apt-get install fortune-mod cowsay |
After installation is done, run this :
1 | fortune | cowsay | lolcat |
Then copy this gist :
1 | https://gist.github.com/dorentus/4689543 |