14

Problem:

The following text is shown for all non-root users when logging in via SSH:

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.


Configuration:

  • My /etc/ssh/sshd_config includes:

    PrintMotd no   
    PrintLastLog no                                                       
    
  • PrintMotd no and PrintLastLog no are overriden by PAM in /etc/pam.d/sshd

    session    optional     pam_motd.so 
    session     optional     pam_lastlog.so   never showfailed
    
  • /var/run/motd is symlinked to /etc/motd:

    /etc/motd -> /var/run/motd
    
  • The folder /etc/update-motd.d/ is empty!


Question:

How can I disable the display of the above notice for non-root users?

Zanna
  • 72,312

3 Answers3

25
  • clear/remove /etc/legal that contains the message

... or ...

  • create a file ~/.cache/motd.legal-displayed

Read more: ubuntuforums.org/showthread.php?t=1511335

Lode
  • 393
samgabbay
  • 704
1

I use Ubuntu 20.04, a release newer than sam's answer. The very old thread cited there was closed 11 years ago and doesn't mention the method I used to fix the problem: emptying the 3 files in /var/lib/ubuntu-advantage/messages.

root:/var/lib/ubuntu-advantage/messages# ls -l
total 0
-rw-r--r-- 1 root root 0 Sep 11 03:10 apt-pre-invoke-esm-service-status
-rw-r--r-- 1 root root 0 Sep 11 03:10 motd-esm-service-status
-rw-r--r-- 1 root root 0 Sep 11 03:09 ubuntu-no-warranty

I found it (and some other files I ignored) by executing this:

find / -xdev -type f -exec grep -l 'ABSOLUTELY NO WARRANTY' {} \;
Jeff Holt
  • 111
0

I'm using Ubuntu 18.04 (yep; I'm a Luddite). The tools run at startup are all in /etc/update-motd.d:

griscom@nob:/$ ls /etc/update-motd.d/
00-header     88-esm-announce            91-release-upgrade      98-fsck-at-reboot
10-help-text  90-updates-available       92-unattended-upgrades  98-reboot-required
50-motd-news  91-contract-ua-esm-status  95-hwe-eol
griscom@nob:/$ 

These are all executable; if you mark them as not executable then they won't be run at startup. Here's my current state, after disabling a number of the (to me) useless announcements and checks:

griscom@nob:/$ ls -l /etc/update-motd.d/
total 48
-rwxr-xr-x 1 root root 1250 Nov 10 09:21 00-header
-rw-r--r-- 1 root root 1157 Apr  9  2018 10-help-text
-rw-r--r-- 1 root root 4992 Aug 13  2020 50-motd-news
-rw-r--r-- 1 root root  107 Nov 10 09:30 88-esm-announce
-rwxr-xr-x 1 root root  127 Nov 10 09:22 90-updates-available
-rw-r--r-- 1 root root  113 Nov 10 09:29 91-contract-ua-esm-status
-rw-r--r-- 1 root root  299 Jun  3  2019 91-release-upgrade
-rw-r--r-- 1 root root  165 Nov 25  2019 92-unattended-upgrades
-rw-r--r-- 1 root root  129 Nov 12  2018 95-hwe-eol
-rwxr-xr-x 1 root root  173 Nov 10 09:26 98-fsck-at-reboot
-rwxr-xr-x 1 root root  175 Nov 10 09:26 98-reboot-required
griscom@nob:/$ 

So, to disable one of these (say, 10-help-text), do:

sudo chmod -x /etc/update-motd.d/10-help-text
Daniel Griscom
  • 274
  • 1
  • 11