libpam-modules

From Mark Furneaux's Wiki
Jump to: navigation, search

libpam-modules is a package which provides the update-motd functionality for Ubuntu which dynamically updates the SSH Message Of The Day.

This page is very out of date and is irrelevant if using modern versions of Debian based operating systems.

Config

Install the landscape-client package to get access to the landscape-sysinfo binary for querying system stats.

All static messages to be displayed in the MOTD should be echoed at the end of /etc/update-motd.d/00-header.

Debian

Debian does not come with the dynamic motd generation scripts. Create the directory /etc/update-motd.d/ and populate it with scripts.

Delete the static motd file and create a link to the dynamic output.
# rm /etc/motd
# ln -s /var/run/motd /etc/motd

Debian will also shutdown the network before terminating SSH connections. This can be fixed by running the following and rebooting:
# apt install libpam-systemd

Fixes

To remove Canonical's plug for their Landscape online documentation service, head the output of the landscape-sysinfo command to remove the bottom line in /etc/update-motd.d/50-landscape-sysinfo:

#!/bin/sh
cores=$(grep -c ^processor /proc/cpuinfo 2>/dev/null)
[ "$cores" -eq "0" ] && cores=1
threshold="${cores:-1}.0"
if [ $(echo "`cut -f1 -d ' ' /proc/loadavg` < $threshold" | bc) -eq 1 ]; then
    echo
    echo -n "  System information as of "
    /bin/date
    echo
    /usr/bin/landscape-sysinfo | head -n 4
else
    echo
    echo " System information disabled due to load higher than $threshold"
fi