pam_motd Other Useful Applications

379

1. pam_motd

When logging into an Ubuntu server you may have noticed the informative Message Of The Day MOTD. This information is obtained and displayed using a couple of packages: • landscape-common: provides the core libraries of landscape-client, which can be used to manage systems using the web based Landscape application. The package includes the usrbinlandscape- sysinfo utility which is used to gather the information displayed in the MOTD. • update-notifier-common: is used to automatically update the MOTD via pam_motd module. pam_motd executes the scripts in etcupdate-motd.d in order based on the number prepended to the script. The output of the scripts is written to varrunmotd , keeping the numerical order, then concatenated with etcmotd.tail . You can add your own dynamic information to the MOTD. For example, to add local weather information: • First, install the weather-util package: sudo apt-get install weather-util • The weather utility uses METAR data from the National Oceanic and Atmospheric Administration and forecasts from the National Weather Service. In order to find local information you will need the 4-character ICAO location indicator. This can be determined by browsing to the National Weather Service 1 site. Although the National Weather Service is a United States government agency there are weather stations available world wide. However, local weather information for all locations outside the U.S. may not be available. • Create usrlocalbinlocal-weather , a simple shell script to use weather with your local ICAO indicator: binsh Prints the local weather information for the MOTD. Replace KINT with your local weather station. Local stations can be found here: http:www.weather.govtgsiteloc.shtml echo weather -i KINT echo 1 http:www.weather.govtgsiteloc.shtml 380 • Make the script executable: sudo chmod 755 usrlocalbinlocal-weather • Next, create a symlink to etcupdate-motd.d98-local-weather : sudo ln -s usrlocalbinlocal-weather etcupdate-motd.d98-local-weather • Finally, exit the server and re-login to view the new MOTD. You should now be greeted with some useful information, and some information about the local weather that may not be quite so useful. Hopefully the local-weather example demonstrates the flexibility of pam_motd. 381

2. etckeeper