Wednesday, 22 March 2017

Cowsay For Linux SSH Login

Cowsay has been around for quite a while now, but I came across it recently. I wanted to have a more interesting login for couple of data protection VMs and other CentOS boxes. If you follow this blog, you will know my domain is happycow.local, as the name "HappyCow" is quite fascinating, also it is my GamerTag on GTA5 (Hehe!).

Cowsay came to the rescue here to get this up and running in few steps. First, I had to get the cowsay package. You can download the package from here. SSH into your Linux box and have this package copied over.

Unzip the tar file by:
# tar -zxvf cowsay_3.03+dfsg2.orig.tar.gz
Post this, get into the directory cowsay-3.03+dfsg2 and run the installation script
# sh
Post this, create the below file:
# vi ~/.ssh/rc
Paste the content you want here for SSH login. My content was:
echo -e "Welcome to VDP \n If it is broken, redeploy" | cowsay
echo -e "\nYour system is been up for $(uptime | cut -d ' ' -f 4,5,6,7)"

Provide chmod u+x to rc file and then restart the sshd service
# service sshd restart
Log back into the terminal and you will see the "Zen-Cow" greeting you.

Looks fun!

1 comment: