~kim0/serverguide/serverguide-review-ch19

« back to all changes in this revision

Viewing changes to build/serverguide/C/pam_motd.html

  • Committer: Matthew East
  • Date: 2011-05-03 07:11:18 UTC
  • Revision ID: mdke@ubuntu.com-20110503071118-081aatibsr9k2yqy
Add files from ubuntu-docs natty branch, trim to use only those necessary for serverguide

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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" />
 
13
  </head>
 
14
  <body>
 
15
    <div id="round">
 
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";
 
21
urchinTracker();
 
22
</script>
 
23
        <div id="header">
 
24
          <div id="logo-floater">
 
25
            <h1>
 
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" />
 
28
              </a>
 
29
            </h1>
 
30
          </div>
 
31
          <noscript>
 
32
            <form action="http://www.google.com/cse" id="cse-search-box">
 
33
              <div>
 
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" />
 
38
              </div>
 
39
            </form>
 
40
          </noscript>
 
41
          <script>
 
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>');
 
51
</script>
 
52
          <div id="sitename">
 
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>
 
56
            </a>
 
57
          </div>
 
58
        </div>
 
59
        <div id="page">
 
60
          <div id="content">
 
61
            <div class="breadcrumbs"><a href="https://help.ubuntu.com/">Ubuntu Documentation</a> &gt; <a href="https://help.ubuntu.com/11.04">Ubuntu 11.04</a> &gt; <span class="breadcrumb-link"><a href="index.html">Ubuntu Server Guide</a></span> &gt; <span class="breadcrumb-link"><a href="other-useful-applications.html">Other Useful Applications</a></span> &gt; <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">
 
64
                <div>
 
65
                  <div>
 
66
                    <h2 class="title" style="clear: both"><a id="pam_motd"></a>pam_motd</h2>
 
67
                  </div>
 
68
                </div>
 
69
              </div>
 
70
              <p>
 
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:
 
73
    </p>
 
74
              <div class="itemizedlist">
 
75
                <ul class="itemizedlist" type="disc">
 
76
                  <li class="listitem">
 
77
                    <p>
 
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
 
81
        in the MOTD.
 
82
        </p>
 
83
                  </li>
 
84
                  <li class="listitem">
 
85
                    <p>
 
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.
 
87
        </p>
 
88
                  </li>
 
89
                </ul>
 
90
              </div>
 
91
              <p>    
 
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>.
 
95
    </p>
 
96
              <p>
 
97
    You can add your own dynamic information to the MOTD.  For example, to add local weather information:
 
98
    </p>
 
99
              <div class="itemizedlist">
 
100
                <ul class="itemizedlist" type="disc">
 
101
                  <li class="listitem">
 
102
                    <p>
 
103
        First, install the <span class="application"><strong>weather-util</strong></span> package:
 
104
        </p>
 
105
                    <pre class="screen">
 
106
<span class="command"><strong>sudo apt-get install weather-util</strong></span>
 
107
</pre>
 
108
                  </li>
 
109
                  <li class="listitem">
 
110
                    <p>
 
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.
 
115
        </p>
 
116
                    <p>
 
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.
 
119
        </p>
 
120
                  </li>
 
121
                  <li class="listitem">
 
122
                    <p>
 
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:
 
125
        </p>
 
126
                    <pre class="programlisting">
 
127
#!/bin/sh
 
128
#
 
129
#
 
130
# Prints the local weather information for the MOTD.
 
131
#
 
132
#
 
133
 
 
134
# Replace KINT with your local weather station.
 
135
# Local stations can be found here: http://www.weather.gov/tg/siteloc.shtml
 
136
 
 
137
echo
 
138
weather -i KINT
 
139
echo
 
140
 
 
141
</pre>
 
142
                  </li>
 
143
                  <li class="listitem">
 
144
                    <p>
 
145
        Make the script executable:
 
146
        </p>
 
147
                    <pre class="screen">
 
148
<span class="command"><strong>sudo chmod 755 /usr/local/bin/local-weather</strong></span>
 
149
</pre>
 
150
                  </li>
 
151
                  <li class="listitem">
 
152
                    <p>
 
153
        Next, create a symlink to <code class="filename">/etc/update-motd.d/98-local-weather</code>:
 
154
        </p>
 
155
                    <pre class="screen">
 
156
<span class="command"><strong>sudo ln -s /usr/local/bin/local-weather /etc/update-motd.d/98-local-weather</strong></span>
 
157
</pre>
 
158
                  </li>
 
159
                  <li class="listitem">
 
160
                    <p>
 
161
        Finally, exit the server and re-login to view the new MOTD.
 
162
        </p>
 
163
                  </li>
 
164
                </ul>
 
165
              </div>
 
166
              <p>
 
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>.
 
170
    </p>
 
171
            </div>
 
172
          </div>
 
173
          <div xmlns="http://www.w3.org/1999/xhtml" class="navfooter">
 
174
            <hr />
 
175
            <table width="100%" summary="Navigation footer">
 
176
              <tr>
 
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" />
 
181
                  </a>
 
182
                </td>
 
183
                <td width="40%" align="right"> <a accesskey="n" href="etckeeper.html"><img src="../../libs/navig/next.png" alt="Next" /></a></td>
 
184
              </tr>
 
185
              <tr>
 
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" />
 
190
                  </a>
 
191
                </td>
 
192
                <td width="40%" align="right" valign="top"> etckeeper</td>
 
193
              </tr>
 
194
            </table>
 
195
          </div>
 
196
          <hr />
 
197
          <div id="footer">
 
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>
 
201
            </div>
 
202
          </div>
 
203
          <div id="bottomcap">
 
204
            <img src="https://help.ubuntu.com/htdocs/ubuntunew/img/cap-bottom.png" alt="" />
 
205
          </div>
 
206
        </div>
 
207
      </div>
 
208
    </div>
 
209
  </body>
 
210
</html>