DEV Community

Cover image for Remove the Message of the Day on Ubuntu 24.04
dev_neil_a
dev_neil_a

Posted on • Edited on

Remove the Message of the Day on Ubuntu 24.04

YouTube Video

If you would prefer to watch the content of this article, there is a video version available on YouTube below:

Introduction

In this article, I’m going to go through the process of removing the message of the day on Ubuntu 24.04. The message of the day, by default, appears when you login to the CLI on Ubuntu and shows things such as the system information and if there are any updates available to install.

So why would you want to remove the message of the day? For me it’s because on slower systems, such as a Raspberry Pi, the message of the day can take a few seconds to run which can delay me getting something done on that system. On higher performing systems, it’s less of a problem.

Another reason is that you might only want a part of the message of the day to be shown or you want a completely different one that you want to be shown.

Removing the Message of the Day

To get started, first open a terminal emulator application of your choice and SSH to the system you need to remove the message of the day from. If it is the local machine, you don’t need to SSH to it. For example:

00

Once connected, change directory to /etc/update-motd.d by running the following command:

cd /etc/update-motd.d
Enter fullscreen mode Exit fullscreen mode

Now, list all the files in the directory:

ls -lsa
Enter fullscreen mode Exit fullscreen mode

You will see a collection of files. Each of these are individual parts that make up the message of the day that is shown when you login. You will notice that the permissions each file has is read, write, execute, read, execute and read, execute (aka 755). Only 50-landscape-sysinfo is different, with it having read, write and execute (aka 777) as it is a symlink.

01

To stop the message of the day appearing at login, simply set the files (minus the 50-landscape file) to not be executable. There are two ways to do this:

sudo chmod 644 *
Enter fullscreen mode Exit fullscreen mode

Or

sudo chmod -x *
Enter fullscreen mode Exit fullscreen mode

Run ls -lsa again to check that the file permissions have changed. For example:

02

All the files now no longer have the executable permission set, except for 50-landscape file as that is not modified due to it being a symlink.

Alternatively, if you just want to stop one (or multiple) parts of the message of the day appearing, you can set the file that has that part in to not be executable and leave the rest as executable. For example, show everything except for the number of updates available. In this case, the 90-updates-available file will need to be set to not be executable:

sudo chmod 644 90-updates-available
Enter fullscreen mode Exit fullscreen mode

Or

sudo chmod -x 90-updates-available
Enter fullscreen mode Exit fullscreen mode

Run ls -lsa again to check that the file permission for 90-updates-available has changed. For example:

03

To check that it worked, logout by typing exit and then login again. You should no longer see the message of the day appear. For example (all files were set to not be executable in the below image):

04

Reverting the Changes

If you want to revert the changes so that the original message of the day is shown at login, you simply need set the files to be executable again.

To do this, first change the directory to /etc/update-motd.d again by running the following command:

cd /etc/update-motd.d
Enter fullscreen mode Exit fullscreen mode

Next, the executable flag needs to be set on the files. There are two ways to do this just as before:

sudo chmod 755 *
Enter fullscreen mode Exit fullscreen mode

Or

sudo chmod +x *
Enter fullscreen mode Exit fullscreen mode

05

If you need to revert just one file instead of all of them, run one of the following commands. I'll use 90-updates-available as an example again:

sudo chmod 755 90-updates-available
Enter fullscreen mode Exit fullscreen mode

Or

sudo chmod +x 90-updates-available
Enter fullscreen mode Exit fullscreen mode

Image description

To check that it worked, logout by typing exit and then login again. When you log back in, only the updates available will be shown in the message of the day area. For example:

07

Conclusion

I hope that this article was useful.

Thank you for reading and have a nice day!

Top comments (0)