How to display message after successful login

Display message of the day after successful login.

Default message of the day looks like this.

$ ssh debian.example.org -l milosz -i ~/.ssh/ext_milosz
Linux buster 4.19.0-4-amd64 #1 SMP Debian 4.19.28-2 (2019-03-15) x86_64

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

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

Last login: Mon Aug 26 22:21:30 2019 from 10.0.2.2
[email protected]:~$ 

The first part is generated dynamically using scripts located in /etc/update-motd.d/ directory.

$ ls /etc/update-motd.d/
10-uname
$ cat /etc/update-motd.d/10-uname 
#!/bin/sh
uname -snrvm
Use this location to store scripts that fetch news or display some additional information about this particular system.

The second part is static and is stored using /etc/motd text file.

$ cat /etc/motd

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

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

It will be preserved across system reboot, so you can edit it without any need for concern that you message will vanish.

It is worth to mention that message of the day is controlled by pam.

$ cat /etc/pam.d/login
[...]
# Prints the last login info upon successful login
# (Replaces the `LASTLOG_ENAB' option from login.defs)
session    optional   pam_lastlog.so

# Prints the message of the day upon successful login.
# (Replaces the `MOTD_FILE' option in login.defs)
# This includes a dynamically generated part from /run/motd.dynamic
# and a static (admin-editable) part from /etc/motd.
session    optional   pam_motd.so motd=/run/motd.dynamic
session    optional   pam_motd.so noupdate
[...]

Inspect pam_motd manual page for more information.