How to change the MOTD on Ubuntu

An image showing what files control parts of the standard MOTD

The Message of the day on linux is helpful, but its long and... a little hard for things to stand out.

MOTD

I had a few questions about the MOTD.

  1. Where is it stored?
  2. How is it set up?
  3. Can I change it?
  4. If I can, how can I test it?

Where is the MOTD stored?

The message of the day on Ubuntu is stored in the /etc/update-motd.d/ folder as a number of scripts.

You can view these scripts by running ls -la /etc/update-motd.d/

How is the MOTD set up?

The Message of the day is broken up into individual scripts. Here's what mine currently shows.

It seems that cat /run/motd.dynamic is run when you login and something else generates it. At least according to, chriserin on their blog.

Can you change the MOTD?

Yes. There's loads of ways to do this.

I don't want to remove it for everyone so you can disable it on a user by user basis by doing this;

touch $HOME/.hushlogin

Then you can add a custom script or echo to /etc/profile/ and it will print it at the end.

I added `neofetch` to mine.

Further Reading

server - How is /etc/motd updated? - Ask Ubuntu Working with the Ubuntu Message of the Day (MOTD) Service | Vultr Docs