Tweak your Ubuntu Message of the Day (MOTD)

Tired of seeing the same message over and over again when you log into your server? Well, I was. Tweaking your MOTD is really easy! Let's do this.

Start from scratch

In Ubuntu, your MOTD is generated by multiple, small scripts. You can disable them by removing the executable permission from each file. To disable every script, simply enter:

$ sudo chmod -x /etc/update-motd.d/*

Now, when you log into your server, only your last login info is displayed. This information isn't part of your MOTD - it is generated by your SSH server. You can disable this by editing /etc/ssh/sshd_config/ and find the line that says:

PrintLastLog yes

Change yes into no. Don't forget to restart your SSH server: sudo service ssh restart.

Server name on steriods

You can spice up your MOTD by showing your server name using Figlet, for example:

 ____             _
|  _ \ __ _ _ __ | |_ ___  _ __
| |_) / _` | '_ \| __/ _ \| '__|
|  _ < (_| | |_) | || (_) | |
|_| \_\__,_| .__/ \__\___/|_|

And why not spruce it up with a little color using Lolcat?

Make sure you have Figlet and Lolcat installed:

$ sudo apt-get install -y figlet
$ sudo gem install lolcat

After that, create a new file named /etc/update-motd.d/10-hostname using your favorite editor:

$ sudo nano /etc/update-motd.d/10-hostname

Paste the following lines into the file and save it:


/usr/bin/env figlet "$(hostname)" | /usr/bin/env lolcat -f

When you're done, make it executable:

$ sudo chmod +x /etc/update-motd.d/10-hostname

Finally, you need to update to your MOTD. In some cases, the update-motd command isn't available, so you'll have to install this one as well:

$ sudo apt-get install -y update-motd
$ sudo update-motd

That's it! And this is only the beginning...

MOTD scripts

There are many script collections you can use to create the best MOTD. Try these links:

Have fun tweaking!