Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

developerWorks Community:

  • Close [x]

LPI exam 102 prep, Topic 108: Linux documentation

Junior Level Administration (LPIC-1) topic 108

Ian Shields, Senior Programmer, IBM developerWorks
Ian Shields
Ian Shields works on a multitude of Linux projects for the developerWorks Linux zone. He is a Senior Programmer at IBM at the Research Triangle Park, NC. He joined IBM in Canberra, Australia, as a Systems Engineer in 1973, and has since worked on communications systems and pervasive computing in Montreal, Canada, and RTP, NC. He has several patents and has published several papers. His undergraduate degree is in pure mathematics and philosophy from the Australian National University. He has an M.S. and Ph.D. in computer science from North Carolina State University. Learn more about Ian in Ian's profile on developerWorks Community.
(An IBM developerWorks Contributing Author)

Summary:  In this tutorial, Ian Shields continues preparing you to take the Linux Professional Institute® Junior Level Administration (LPIC-1) Exam 102. In this fourth in a series of nine tutorials, Ian introduces you to Linux® documentation. By the end of this tutorial, you will know how to use and manage local documentation, find documentation on the Internet, and use automated logon messages to notify users of system events.

View more content in this series

Date:  20 Sep 2006
Level:  Intermediate PDF:  A4 and Letter (478 KB | 21 pages)Get Adobe® Reader®

Activity:  20411 views
Comments:  

Notifying users

This section covers material for topic 1.108.5 for the Junior Level Administration (LPIC-1) exam 102. The topic has a weight of 1.

In this section, learn how to:

  • Notify the users about current issues related to the system through logon messages

Logon messages

The final short section of this tutorial introduces you to three different logon messages. These have their roots in non-graphical ASCII terminal access to multiuser UNIX® systems and are of diminishing importance today when many workstations are single-user systems, and much access uses a graphical workstation running a desktop such as GNOME or KDE, where these facilities are all but inoperative.

/etc/issue and /etc/issue.net

The first two of these, /etc/issue and /etc/issue.net, are displayed on an ASCII terminal that is connected locally (/etc/issue) or remotely (/etc/issue.net). Listing 16 illustrates these two files as found on a stock Fedora Core 5 system.


Listing 16. /etc/issue and /etc/issue.net
[ian@attic4 ~]$ cat /etc/issue
Fedora Core release 5 (Bordeaux)
Kernel \r on an \m

[ian@attic4 ~]$ cat /etc/issue.net
Fedora Core release 5 (Bordeaux)
Kernel \r on an \m
[ian@attic4 ~]$

Notice the control sequences \r and \m. These allow information such as date or system name to be inserted in the message. The control sequences are shown in Table 4 and are the same as allowed for the mingetty command.

Table 4. Control sequences for /etc/issue and /etc/issue.net
SequencePurpose
\dInserts the current day according to localtime
\lInserts the line on which mingetty is running
\mInserts the machine architecture (equivalent to uname -m)
\nInserts the machine's network node hostname (equivalent to uname -n)
\oInserts the domain name
\rInserts the operating system release (equivalent to uname -r)
\t Inserts the current time according to localtime
\sInserts the operating system name
\u or \UInserts the current number of users logged in. \U inserts "n users", while \u inserts only "n".
\vInserts the operating system version (equivalent to uname -v)

So you can see that the examples in Listing 16 insert the operating system release level and the machine architecture. Connecting via telnet to this system will cause the /etc/issue.net message to be displayed before the login prompt as shown in Listing 17.


Listing 17. Telnet connections display /etc/issue.net
Fedora Core release 5 (Bordeaux)
Kernel 2.6.17-1.2174_FC5 on an x86_64
login: ian
Password:

If you update /etc/issue.net to include a few more control sequences as shown in Listing 18, your logon prompt might look like that in Listing 19.


Listing 18. Updated /etc/issue.net
[ian@attic4 ~]$ cat /etc/issue.net
Fedora Core release 5 (Bordeaux)
Kernel \r on an \m

\n
Date \d
Time \t



Listing 19. Revised telnet logon prompt
Fedora Core release 5 (Bordeaux)
Kernel 2.6.17-1.2174_FC5 on an x86_64
localhost.localdomain
Date 22:55 on Friday, 15 September 2006
Time 22:55 on Friday, 15 September 2006



login: ian
Password:

Notice that on this system \d and \t produce the same result. As it happens, neither \u nor \U insert the number of users logged in. This perhaps reflects the fact that these messages have very little use these days. The use of telnet with its passwords flowing in the clear is strongly discouraged. Since a connection using ssh passes the login id and therefore bypasses a login prompt, and since real ASCII terminals remotely connected are rare, the contents of /etc/issue.net are rarely seen, and probably not tested too well either.

You will see the contents of /etc/issue if you do not use a graphical login. Even if you do, you can usually get a non-graphical login at the system console using Ctrl-Alt-F1 through Ctrl-Alt-F6, with Ctrl-Alt-F7 returning you to the graphical terminal.

Message of the day

Both /etc/issue and /etc/issue.net provide user feedback in the form of a logon prompt and could also be used to advise users of issues such as impending outages. However, this is usually done with a message of the day or motd, which is stored in /etc/motd. The contents of /etc/motd are displayed after a successful login but just before the login shell is started. Listing 20 shows an example of a motd file, and Listing 21 shows how it and /etc/issue.net appear to a user logging in through a telnet session.


Listing 20. Sample message of the day (motd)
[ian@attic4 ~]$ cat /etc/motd

PLEASE NOTE!

All systems will shut down this weekend for emergency power testing.

Save your work or lose it.


Listing 20. Sample message of the day (motd)
Fedora Core release 5 (Bordeaux)
Kernel 2.6.17-1.2174_FC5 on an x86_64
localhost.localdomain
Date 22:55 on Friday, 15 September 2006
Time 22:55 on Friday, 15 September 2006



login: ian
Password:
Last login: Fri Sep 15 22:54:18 from 192.168.0.101

PLEASE NOTE!

All systems will shut down this weekend for emergency power testing.

Save your work or lose it.
[ian@attic4 ~]$ 

Again, the motd is really only useful on ASCII terminal sessions. Neither KDE nor GNOME desktops have an easy and satisfactory way of displaying it.

One final notification method that you should know about is the wall command, which sends a warning to all logged-in users using text from either a file or stdin. Again, these are not seen by users using the standard GNOME or KDE desktops.

Don't forget to rate this tutorial and give us your feedback.

4 of 6 | Previous | Next

Comments



static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Linux, Open source
ArticleID=161154
TutorialTitle=LPI exam 102 prep, Topic 108: Linux documentation
publish-date=09202006
author1-email=ishields@us.ibm.com
author1-email-cc=