Skip to content

Message of the day (MOTD)

Overview

Message of the day (shortcut of motd) is a text content are displayed after a successful login and before it executes the login shell (From 1).

The traditional welcome message known as the sudo lecture, which is a built-in feature of the sudo command. It aims to remind users of their ethical and technical responsibilities when using elevated privileges.

For example:

We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things:
  #1) Respect the privacy of others.
  #2) Think before you type.
  #3) With great power comes great responsibility.

The three points emphasize the importance of responsible behavior when using elevated privileges:

  1. Be mindful of others' privacy – Avoid snooping into other users' files, emails, or activities.

  2. Exercise caution when typing commands – Take your time to think through the potential consequences of each command, especially those that can impact system stability or security.

  3. Remember that power comes with responsibility – A reminder to use your access wisely, as the actions you take can have significant consequences.

The historical roots of motd can be traced back to 2002, when Red Hat's sudo package first introduced it in June 2002. Later, in January 2004, it was merged into the official sudo repository. The phrase "With great power comes great responsibility" is often attributed to Spider-Man's Uncle Ben, but similar sentiments have existed for centuries. Bob Coggeshall, the original sudo tool developer (around 1980), might have been influenced by Evi Nemeth, a systems administrator at the University of Colorado Boulder, when creating the message.

Usage

Customize or turn off the message

To customize the welcome message, you can edit the /etc/motd file. For example, using Copilot to design for me

/etc/motd
##############################################################
#                                                            #
#   🧠 MOTD: "Think deeply. Type wisely. Build boldly."      #
#                                                            #
#   🧾 System Info:                                           #
#     • User        : $USER                                  #
#     • Release     : $(lsb_release -d | cut -f2)            #
#     • OS          : $(uname -s) $(uname -r)                #
#     • CPU/RAM     : $(lscpu | grep 'Model name') / $(free -h | grep Mem) #
#                                                            #
#   🛡️ Reminder:                                              #
#     1) Respect the privacy of others.                      #
#     2) Think before you type.                              #
#     3) With great power comes great responsibility.        #
#                                                            #
##############################################################

If you want to see the message every time you use sudo, you can configure it by editing the /etc/sudoers.d/privacy file.

sudo nano /etc/sudoers.d/privacy

Then add:

/etc/sudoers.d/privacy
Defaults lecture = always

This ensures the lecture appears every time you use sudo.

See: https://superuser.com/questions/500119/keeping-the-fancy-sudo-warning-forever

📚 Further Reading