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
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.
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
|\d||Inserts the current day according to localtime|
|\l||Inserts the line on which mingetty is running|
|\m||Inserts the machine architecture (equivalent to uname -m)|
|\n||Inserts the machine's network node hostname (equivalent to uname -n)|
|\o||Inserts the domain name|
|\r||Inserts the operating system release (equivalent to uname -r)|
|\t||Inserts the current time according to localtime|
|\s||Inserts the operating system name|
|\u or \U||Inserts the current number of users logged in. \U inserts "n users", while \u inserts only "n".|
|\v||Inserts 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.
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.