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

Xrdp creates a strange directory called thinclient_drives

In Ubuntu 18.04, Bionic Beaver, if you are using xrdp for remote access, you may notice a directory called "thinclient_drives" appearing in your home directory. In the permissions it may show a bunch of question marks, which looks scary.

There seems to be a bug in xrdp code which attempts to share drives, clipboard and other things. It is creating this directory and not mounting it correctly. Here is how to get rid of it.

Edit /etc/xrdp/xrdp.ini. Update the allow_channels setting to say allow_channels=false.

After saving the change, remove the spurious thinclient_drives directory. If the system will not allow you to remove it, first unmount it with
sudo umount $HOME/thinclient_drives

You will not be able to use shared drives, clipboard, and so on, but those do not seem to be working anyway.

Xrdp shows a blank screen with Ubuntu 18.04, Bionic Beaver

If you are trying to use remote desktop on Ubuntu or Xubuntu 18.04 you may find that after logging in all you see is a blank screen.

One cause of this is that xfce4 has added code that prevents a second session from opening. You will find that if your computer's main screen is logged into xfce4 you may not be able to use it with xrdp.

To solve this "second session" problem and allow as many sessions as you need, edit /etc/xrdp/startwm.sh and add these lines before the lines that test and execute Xsession. The $HOME/.profile is not part of the solution, but is something that should be run before starting the session anyway.

unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR
. $HOME/.profile