How to remove legal notice from MOTD / Banner for non-root users

13,006

Solution 1

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

... or ...

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

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

Solution 2

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' {} \;
Share:
13,006

Related videos on Youtube

Nicolai Fröhlich
Author by

Nicolai Fröhlich

Updated on September 18, 2022

Comments

  • Nicolai Fröhlich
    Nicolai Fröhlich over 1 year

    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?