1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head xmlns="http://www.w3.org/1999/xhtml">
5
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
<title xmlns="">pam_motd</title>
7
<link rel="stylesheet" href="../../libs/ubuntu-book.css" type="text/css" />
8
<link rel="home" href="index.html" title="Ubuntu Server Guide" />
9
<link rel="up" href="other-useful-applications.html" title="Chapter 22. Other Useful Applications" />
10
<link rel="prev" href="other-useful-applications.html" title="Chapter 22. Other Useful Applications" />
11
<link rel="next" href="etckeeper.html" title="etckeeper" />
12
<link rel="copyright" href="legal.html" title="Credits and License" />
16
<img id="topcap" alt="" src="https://help.ubuntu.com/htdocs/ubuntunew/img/cap-top.png" />
17
<div id="layout" class="container clear-block">
18
<script xmlns="" src="https://ssl.google-analytics.com/urchin.js" type="text/javascript"></script>
19
<script xmlns="" type="text/javascript">
20
_uacct = "UA-1018242-8";
24
<div id="logo-floater">
26
<a href="https://help.ubuntu.com" title="Ubuntu Documentation">
27
<img alt="Ubuntu" id="logo" src="https://help.ubuntu.com/htdocs/ubuntunew/img/logo.png" />
32
<form action="http://www.google.com/cse" id="cse-search-box">
34
<input type="hidden" name="cx" value="003883529982892832976:e2vwumte3fq" />
35
<input type="hidden" name="ie" value="UTF-8" />
36
<input type="text" name="q" size="27" />
37
<input type="submit" name="sa" value="Search" />
42
document.write('<form action="https://help.ubuntu.com/search.html" id="cse-search-box">');
43
document.write(' <div>');
44
document.write(' <input type="hidden" name="cof" value="FORID:9" />');
45
document.write(' <input type="hidden" name="cx" value="003883529982892832976:e2vwumte3fq" />');
46
document.write(' <input type="hidden" name="ie" value="UTF-8" />');
47
document.write(' <input type="text" name="q" size="27" />');
48
document.write(' <input type="submit" name="sa" value="Search" />');
49
document.write(' </div>');
50
document.write('</form>');
53
<a href="https://help.ubuntu.com/">
54
<img alt="Official Documentation" src="https://help.ubuntu.com/htdocs/ubuntunew/img/help-about.png" />
55
<span>Official Documentation</span>
61
<div class="breadcrumbs"><a href="https://help.ubuntu.com/">Ubuntu Documentation</a> > <a href="https://help.ubuntu.com/11.04">Ubuntu 11.04</a> > <span class="breadcrumb-link"><a href="index.html">Ubuntu Server Guide</a></span> > <span class="breadcrumb-link"><a href="other-useful-applications.html">Other Useful Applications</a></span> > <span class="breadcrumb-node">pam_motd</span></div>
62
<div xmlns="http://www.w3.org/1999/xhtml" class="sect1" title="pam_motd">
63
<div class="titlepage">
66
<h2 class="title" style="clear: both"><a id="pam_motd"></a>pam_motd</h2>
71
When logging into an Ubuntu server you may have noticed the informative Message Of The Day (MOTD). This information
72
is obtained and displayed using a couple of packages:
74
<div class="itemizedlist">
75
<ul class="itemizedlist" type="disc">
78
<span class="emphasis"><em>landscape-common:</em></span> provides the core libraries of <span class="application"><strong>landscape-client</strong></span>,
79
which can be used to manage systems using the web based <span class="emphasis"><em>Landscape</em></span> application. The package includes
80
the <span class="application"><strong>/usr/bin/landscape-sysinfo</strong></span> utility which is used to gather the information displayed
86
<span class="emphasis"><em>update-notifier-common:</em></span> is used to automatically update the MOTD via <span class="application"><strong>pam_motd</strong></span> module.
92
<span class="application"><strong>pam_motd</strong></span> executes the scripts in <code class="filename">/etc/update-motd.d</code> in order based on the number
93
prepended to the script. The output of the scripts is written to <code class="filename">/var/run/motd</code>, keeping the numerical order,
94
then concatenated with <code class="filename">/etc/motd.tail</code>.
97
You can add your own dynamic information to the MOTD. For example, to add local weather information:
99
<div class="itemizedlist">
100
<ul class="itemizedlist" type="disc">
101
<li class="listitem">
103
First, install the <span class="application"><strong>weather-util</strong></span> package:
106
<span class="command"><strong>sudo apt-get install weather-util</strong></span>
109
<li class="listitem">
111
The <span class="application"><strong>weather</strong></span> utility uses METAR data from the National Oceanic and Atmospheric Administration
112
and forecasts from the National Weather Service. In order to find local information you will need the 4-character ICAO
113
location indicator. This can be determined by browsing to the
114
<a class="ulink" href="http://www.weather.gov/tg/siteloc.shtml" target="_top">National Weather Service</a> site.
117
Although the National Weather Service is a United States government agency there are weather stations available world wide.
118
However, local weather information for all locations outside the U.S. may not be available.
121
<li class="listitem">
123
Create <code class="filename">/usr/local/bin/local-weather</code>, a simple shell script to use
124
<span class="application"><strong>weather</strong></span> with your local ICAO indicator:
126
<pre class="programlisting">
130
# Prints the local weather information for the MOTD.
134
# Replace KINT with your local weather station.
135
# Local stations can be found here: http://www.weather.gov/tg/siteloc.shtml
143
<li class="listitem">
145
Make the script executable:
148
<span class="command"><strong>sudo chmod 755 /usr/local/bin/local-weather</strong></span>
151
<li class="listitem">
153
Next, create a symlink to <code class="filename">/etc/update-motd.d/98-local-weather</code>:
156
<span class="command"><strong>sudo ln -s /usr/local/bin/local-weather /etc/update-motd.d/98-local-weather</strong></span>
159
<li class="listitem">
161
Finally, exit the server and re-login to view the new MOTD.
167
You should now be greeted with some useful information, and some information about the local weather that may not be
168
quite so useful. Hopefully the <span class="application"><strong>local-weather</strong></span> example demonstrates the flexibility of
169
<span class="application"><strong>pam_motd</strong></span>.
173
<div xmlns="http://www.w3.org/1999/xhtml" class="navfooter">
175
<table width="100%" summary="Navigation footer">
177
<td width="40%" align="left"><a accesskey="p" href="other-useful-applications.html"><img src="../../libs/navig/prev.png" alt="Prev" /></a> </td>
178
<td width="20%" align="center">
179
<a accesskey="u" href="other-useful-applications.html">
180
<img src="../../libs/navig/up.png" alt="Up" />
183
<td width="40%" align="right"> <a accesskey="n" href="etckeeper.html"><img src="../../libs/navig/next.png" alt="Next" /></a></td>
186
<td width="40%" align="left" valign="top">Chapter 22. Other Useful Applications </td>
187
<td width="20%" align="center">
188
<a accesskey="h" href="index.html">
189
<img src="../../libs/navig/home.png" alt="Home" />
192
<td width="40%" align="right" valign="top"> etckeeper</td>
198
<div id="ubuntulinks">
199
<p>The material in this document is available under a free license, see <a href="/legal.html">Legal</a> for details<br />
200
For information on contributing see the <a href="https://wiki.ubuntu.com/DocumentationTeam">Ubuntu Documentation Team wiki page</a>. To report a problem, visit the <a href="https://bugs.launchpad.net/ubuntu/+source/ubuntu-docs">bug page for Ubuntu Documentation</a></p>
204
<img src="https://help.ubuntu.com/htdocs/ubuntunew/img/cap-bottom.png" alt="" />