The file /etc/motd contains the message displayed by the server when an ssh connection is established. For a default Debian system, this message reads:
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.
Bla blup, gna gna gna gna. Nothing is more dreadful and dull than legal disclaimers.
As an alibi, Debian adds a script in /etc/update-motd.d that executes the command
resulting on pdes-net.org in
Linux v22016124074441159 4.12.0-1-amd64 #1 SMP Debian 4.12.6-1 (2017-08-12) x86_64
which is almost as boring as the legal blah-blah above. I don't need to be reminded that I'm using Linux, nor that it's the 64 bit variant (and that even twice). The hostname isn't hot news either, and it would certainly suffice to show the kernel version only once.
Imagine instead a dynamic message, one that truly constitutes a message of the day (MOTD). I'd like to see, for example, the current system load at login, and information concerning the systems available ressources.
Searching the interwebs for that, I first found lots of outdated and contradictory information, but finally this very useful guide for current Debian versions. In essence, one can put arbitrary scripts in /etc/update-motd.d. Instead of writing these scripts myself, I've used the ones of Nick Charlton that seem very close to what I wanted.
Because of the update query, these scripts delay ssh login by about 0.7 s. Let's see what my fellow PdeS will say about that. duck
Update 21.8.17: I totally forgot the obligatory “screenshot”:
[cobra:~] $ ssh pdes _ _ _ __ __| | ___ ___ _ __ ___| |_ ___ _ __ __ _ | '_ \ / _` |/ _ \/ __|_____| '_ \ / _ \ __| / _ \| '__/ _` | | |_) | (_| | __/\__ \_____| | | | __/ |_ | (_) | | | (_| | | .__/ \__,_|\___||___/ |_| |_|\___|\__(_)___/|_| \__, | |_| |___/ Welcome to Debian GNU/Linux testing (buster) (4.12.0-1-amd64). System information as of: Mon Aug 21 19:35:08 CEST 2017 System load: 0.00 Memory usage: 1.6% Usage on /: 1% Swap usage: 0.0% Local users: 3 0 updates to install. 0 are security updates. You have new mail. Last login: Sun Aug 20 11:14:11 2017 from 220.127.116.11
Update 26.8.17: Nick's elaborate python script for detecting updatable packages doesn't work here. I've replaced it with a simple bash one-liner: