Disable dynamic motd and news on Ubuntu 20.04 Focal Fossa Linux

The objective of this article is to disable dynamic motd and news on Ubuntu 20.04 Focal Fossa Linux.

In this tutorial you will learn:

  • How to motd login news
  • How to motd dynamic messages
  • How to silence motd dynamic messages system-wide
  • How to silence motd dynamic messages on per user basis

dynamic motd and news on Ubuntu 20.04 Focal Fossa Linux

Dynamic motd and news on Ubuntu 20.04 Focal Fossa Linux

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Installed Ubuntu 20.04 or upgraded Ubuntu 20.04 Focal Fossa
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to Disable dynamic motd and news on Ubuntu 20.04 step by step instructions

  1. In the first step we will disable dynamic MOTD news. To do so edit the /etc/default/motd-news file and change:
    FROM:
    ENABLED=1
    TO:
    ENABLED=0
    

    This will disable the dynamic MOTD news upon login including SSH login.

  2. The actual MOTD message consists of multiple parts each providing a different information. For example package upgrade information, file-system check etc. The location of MOTD scripts is /etc/update-motd.d and by removing the executable permissions of any particular script will disable the script’s message to show up on MOTD.

    Disabling parts of the MOTD dynamic message is simple. Locate any part of the script you wish to disable and remove executable permissions by using the chmod command. For example the following command will disable updates available message:

    $ sudo chmod -x /etc/update-motd.d/90-updates-available
    


  3. To disable and hence silent all MOTD messages for all users simply run command:
    $ sudo chmod -x /etc/update-motd.d/*
    

    To re-enable MOTD messages enter:

    $ sudo chmod +x /etc/update-motd.d/*
    
  4. It is also possible to disable MOTD messages on per user basis by creating an empty .hushlogin file in users directory. Login to the Ubuntu system you wish to disable MOTD messages and execute:
    $ touch $HOME/.hushlogin