Home Ubuntu How To Disable Ads In Terminal Welcome Message In Ubuntu Server

How To Disable Ads In Terminal Welcome Message In Ubuntu Server

By sk
Published: Last Updated on 9.2K views

If you're using any latest Ubuntu server edition, you might have noticed some promotional links in the welcome message, which are not relevant to Ubuntu server platform.

As you might already know MOTD, abbreviation of Message Of The Day, displays a welcome message at every login in Linux systems.

Usually, the welcome message contains the version of your OS, basic system information, official documentation link, and the links to read about the latest security updates etc. This is what we usually see every time we login either via SSH or on the local machine.

However, there are some additional links started to appear in the terminal welcome message lately. I have already noticed this link few times, but I didn't care about it and never clicked it though.

Here is the Terminal welcome message shown in my Ubuntu 18.04 LTS server.

Ubuntu Terminal welcome message
Terminal welcome message in Ubuntu

As you can see in the above screenshot, there is also a bit.ly link and Ubuntu wiki link in the welcome message. Some of you may wonder what is this.

There is nothing to worry about the links in the welcome message. It may look sort of ad-like, but those are not really commercial ads. The links are actually pointing to Ubuntu official blog and Ubuntu wiki.

As I said earlier, one of link is not relevant and doesn't has any details related to Ubuntu server. That's why I called them ads in the first place.

I guess most of you won't visit bit.ly links. But some people may visit those links out of curiosity and ended up disappointed realizing that it simply points you to an external link.

You can use any URL unshortners services, such as unshorten.it, to see where they lead you before visiting the actual link. Alternatively, you can just type a plus sign (+) at the end of the bit.ly link to see where they lead and some statistics about the link.

shortlink statistics
shortlink statistics


What is MOTD and how it works?

Back in 2009, Dustin Kirkland from Canonical introduced the concept of MOTD in Ubuntu. It's a flexible framework that enables the administrators or distro packages to add executable scripts in /etc/update-motd.d/* location to generate informative, interesting messages displayed at login.

It was originally implemented for Landscape (a commercial service from Canonical), however other distribution maintainers found it useful and adopted this feature in their own distributions as well.

If you look in /etc/update-motd.d/ location in your Ubuntu system, you'll see a set of scripts. One prints the generic "welcome" banner. The next one prints 3 links showing where to find help for the OS. The other one counts and displays the number of package updates available for the local system. Another one tells you if a reboot is required and so on.

From Ubuntu 17.04 onwards, the developers have added /etc/update-motd.d/50-motd-news, a script to include some additional information in the welcome message. They additional information are;

  1. Important critical information, such as ShellShock, Heartbleed etc.
  2. End-of-Life (EOL) messages, new feature availability, etc.
  3. Some fun and informative posts published in Ubuntu official blog and other news about Ubuntu.

Asynchronously, about 60 seconds after boot, a systemd timer runs "/etc/update-motd.d/50-motd-news --force" script. It sources 3 config variables defined in /etc/default/motd-news script. The default values are: ENABLED=1, URLS="https://motd.ubuntu.com", WAIT="5".

Here is the contents of /etc/default/motd-news file:

$ cat /etc/default/motd-news
# Enable/disable the dynamic MOTD news service
# This is a useful way to provide dynamic, informative
# information pertinent to the users and administrators
# of the local system

# Configure the source of dynamic MOTD news
# White space separated list of 0 to many news services
# For security reasons, these must be https
# and have a valid certificate
# Canonical runs a service at motd.ubuntu.com, and you
# can easily run one too

# Specify the time in seconds, you're willing to wait for
# dynamic MOTD news
# Note that news messages are fetched in the background by
# a systemd timer, so this should never block boot or login

Good thing is MOTD is fully customizable, so you can disable it entirely (ENABLED=0), change or add scripts as you wish, and change the wait time in seconds etc.

If MOTD is enabled, that systemd timer job will loop over each of the URLS, trim them to 80 characters per line, and a maximum of 10 lines, and concatenate them to a cache file in /var/cache/motd-news.

This systemd timer job will re-run and update the /var/cache/motd-news every 12 hours. Upon user login, the contents of /var/cache/motd-news is just printed to screen. This is how MOTD works.

Also,  a custom user-agent string is included in /etc/update-motd.d/50-motd-news file to report information about your computer. If you look into /etc/update-motd.d/50-motd-news file, you will see the following code:

# Piece together the user agent
USER_AGENT="curl/$curl_ver $lsb $platform $cpu $uptime"

That means, the MOTD retriever reports your operating system release, hardware platform, CPU type and uptime to Canonical.

Hope you got the basic idea about MOTD.

Let us now get back to the topic. I don't want this feature, how to disable it? If the promotional links in the welcome message still bothers you and you wanted to disable them permanently, here is a quick way to disable it.

Disable Ads In Terminal Welcome Message In Ubuntu Server

To disable these ads, edit the following file:

$ sudo vi /etc/default/motd-news

Find the following line and set its value as 0 (zero).


Save and close the file. Now, reboot your system and see if the welcome message stills showing the links from Ubuntu blog.

Terminal welcome message in Ubuntu 18.04 LTS server
Terminal welcome message in Ubuntu 18.04 LTS server

See? There are no links from Ubuntu blog and Ubuntu wiki now.

You can also restart the motd-news service instead of rebooting the Ubuntu system:

$ sudo systemctl restart motd-news

And, that's all for now. Hope this helps.

Source & Reference:

You May Also Like


van.work August 22, 2018 - 7:22 pm

Stop using Ubuntu. It will only get worse. In the near future, you’ll spend more time undoing their meddling than its worth. You may as well be using Window$ server or SUSE. Switch to CentOS or Debian if you want a Linux server with no ads or BS.

vansadork August 22, 2018 - 11:53 pm

You sound as bad as the “stop using windows” snobbery. Linux is open source which lets those of us that are tech savvy model it as we want to. Let me guess, you’re an Arch hipster that uses the vegan philosophy of pushing it down everyone else’s throats because they’re not using it?

Bogmul August 24, 2018 - 9:05 pm

I would switch OS if it included advertising.

erik August 26, 2018 - 2:21 pm

I just updated to 18.04 server LTS and was greeted with ads. This freaked me out that someone is sending data to my servers in my LAN
that I had not asked or opted for in any way, knowingly. Right there @ boot. And apparently it also download information.
This is a steep slippery road that I never thought that I would see on a Linux server OS.
I’m still shocked.
Now I have to find another OS as in another distribution.

Daniel Reinhardt September 16, 2019 - 6:27 pm

I have been using Ubuntu Server for the last year at version 18.04, and have never been presented with the aforementioned ads upon logging into a users session via terminal or via ssh.

And yes my files were never edited to allow it.

René July 11, 2020 - 2:54 pm

Do you guys pay for Ubuntu? Then don’t complain. You can deactivate it so I don’t see the problem. Compare that with OS or applications where they really force you to accept their ads.

Melroy van den Berg December 21, 2020 - 1:04 am

Instead of restarting your system, just execute: sudo systemctl restart motd-news

sk December 21, 2020 - 10:47 am

Thanks. I didn’t know. Updated the guide.

VeBu March 19, 2022 - 2:28 pm

For me (on ubuntu 20.04 LTS), is no need ror restart or sudo systemctl restart motd-news.
I was only need to do ENABLED=0 and then it worked.

Andrew February 7, 2022 - 9:35 pm

MOTD predates Ubuntu. The Dynamic MOTD traces back to 2009, but a static motd has been around a LONG time. (I am only locating a 2007 reference just now. [1])

Otherwise, thank you. This was informative and helpful.

[1] Release notes for Debian Etch dated to 2007. https://www.debian.org/releases/etch/hppa/release-notes/ch-information.en.html


Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More