Pat David Avatar
ABOUT ARCHIVE
Theme

Ubuntu SSH Ads (motd)

Much to the chagrin of my friend darix, I run an Ubuntu server at home for various things like Nextcloud and Plex. (Chagrin because it’s not openSUSE… yet.) I had installed the previous Long Term Support (LTS) version, 16.04 because I just need the thing to run and be solid. The time had come for a new LTS release and I figured I might as well sit down and get upgraded to 18.04.

Mostly you hear from people when things go wrong, and this time I thought it’d be nice to say something from a positive view. I upgraded over SSH and everything went super smoothly. Awesome! There was one small hiccup with SSH not being enabled when I rebooted the first time but it was quickly sorted out.

The funnier part was some weird news updates being shown in my Message of the Day (motd) when I logged into the machine. (update: user @Qwxlea@tuxspace.net on Mastodon found this LWN article about it by Jake Edge back in 2017.) I think I’ve seen a few people calling them “ads”, but really what happens is the motd scripts pull news from a URL to show you. Here’s what mine looked like:

Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-32-generic x86_64)

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2       913G  745G  122G  86% /

 * Read about Ubuntu updates for L1 Terminal Fault Vulnerabilities
   (L1TF).

   - https://ubu.one/L1TF

 * Check out 6 great IDEs now available on Ubuntu. There may even be
   something worthwhile there for those crazy EMACS fans ;)

   - https://bit.ly/6-cool-IDEs

 * Canonical Livepatch is available for installation.
   - Reduce system reboots and improve kernel security. Activate at:
     https://ubuntu.com/livepatch

0 packages can be updated.
0 updates are security updates.

The issue some folks have is with the first couple of bullet points (and a bit.ly link? Really?).

Taking a look in /etc/update-motd.d/50-motd-news and right at the top of the file Dustin was kind enough to tell us he insisted on transparency for this:

##############################################################################
# This program could be rewritten in C or Golang for faster performance.
# Or it could be rewritten in Python or another higher level language
# for more modularity.
# However, I've insisted on shell here for transparency!
#                                                                     - Dustin
##############################################################################

Remove the News

Also at the top of that file is the clue on fixing this for your installation. The key is to modify the file /etc/default/motd-news and change ENABLED=1 to ENABLED=0:

# 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
ENABLED=0

Et voilà!


Filed under: ubuntu, linux, ssh

Share this on: Google+ | Twitter | Facebook