Get rid of Canonical's terminal login advertising in Ubuntu

Lately, when logging onto Ubuntu from SSH or from a terminal using Ctrl-Alt-F1, you may notice a bunch of canonical advertising, like this:


Welcome to Ubuntu 18.04 LTS (GNU/Linux 4.15.0-20-generic x86_64)

* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage

* Meltdown, Spectre and Ubuntu: What are the attack vectors,
how the fixes work, and everything else you need to know
- https://ubu.one/u2Know

* 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.

*** /dev/sda6 will be checked for errors at next reboot ***

Last login: Thu May 24 15:19:28 2018 from 192.168.0.188


If you want to get rid of some of the guff, here is what to do. Only do this if you do not use or plan to use Canonical's Paid Ubuntu livepatch service

1. edit /etc/default/motd-news and change
ENABLED=1
to
ENABLED=0
2. edit /etc/update-motd.d/80-livepatch and add  
exit 0
after the "#!/bin/sh.
3. edit /etc/update-motd.d/10-help-text and remove the printf lines or put exit 0 before them.

Now the login looks like this:

Welcome to Ubuntu 18.04 LTS (GNU/Linux 4.15.0-22-generic x86_64)

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

*** /dev/sda6 will be checked for errors at next reboot ***

Last login: Fri May 25 17:06:19 2018

You can further get rid of any of the remaining messages by looking at the other files in /etc/update-motd.d/ and making appropriate changes.

Update May 16 2021:
There is a much easier way to fix this, per user.
In your home directory create an empty file called .hushlogin

cd
touch .hushlogin

3 comments: