]>
Commit | Line | Data |
---|---|---|
b5d655f7 A |
1 | .\" $NetBSD: utmp.5,v 1.5 1994/11/30 19:31:35 jtc Exp $ |
2 | .\" | |
3 | .\" Copyright (c) 1980, 1991, 1993 | |
4 | .\" The Regents of the University of California. All rights reserved. | |
5 | .\" | |
6 | .\" Redistribution and use in source and binary forms, with or without | |
7 | .\" modification, are permitted provided that the following conditions | |
8 | .\" are met: | |
9 | .\" 1. Redistributions of source code must retain the above copyright | |
10 | .\" notice, this list of conditions and the following disclaimer. | |
11 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
12 | .\" notice, this list of conditions and the following disclaimer in the | |
13 | .\" documentation and/or other materials provided with the distribution. | |
14 | .\" 3. All advertising materials mentioning features or use of this software | |
15 | .\" must display the following acknowledgement: | |
16 | .\" This product includes software developed by the University of | |
17 | .\" California, Berkeley and its contributors. | |
18 | .\" 4. Neither the name of the University nor the names of its contributors | |
19 | .\" may be used to endorse or promote products derived from this software | |
20 | .\" without specific prior written permission. | |
21 | .\" | |
22 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
23 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
24 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
25 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
26 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
27 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
28 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
29 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
30 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
31 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
32 | .\" SUCH DAMAGE. | |
33 | .\" | |
34 | .\" @(#)utmp.5 8.2 (Berkeley) 3/17/94 | |
35 | .\" | |
36 | .Dd March 17, 1994 | |
37 | .Dt UTMP 5 | |
38 | .Os BSD 4 | |
39 | .Sh NAME | |
40 | .Nm utmp , | |
41 | .Nm wtmp , | |
42 | .Nm lastlog | |
43 | .Nd login records (DEPRECATED) | |
44 | .Sh SYNOPSIS | |
45 | .Fd #include <utmp.h> | |
46 | .Sh DESCRIPTION | |
47 | The interfaces in file | |
48 | .Aq Pa utmp.h | |
49 | are all | |
5f4d86c1 | 50 | .Sy DEPRECATED |
b5d655f7 A |
51 | and are only provided for compatibility with previous releases of Mac OS X. |
52 | See | |
53 | .Xr pututxline 3 | |
54 | and | |
55 | .Xr utmpx 5 | |
56 | for the supported interfaces. | |
57 | .Pp | |
58 | .Aq Pa utmp.h | |
59 | declares the structures used to record information about current | |
60 | users in the file | |
61 | .Nm utmp , | |
62 | logins and logouts in the file | |
63 | .Nm wtmp , | |
64 | and last logins in the file | |
65 | .Nm lastlog . | |
66 | The time stamps of date changes, shutdowns and reboots are also logged in | |
67 | the | |
68 | .Nm wtmp | |
69 | file. | |
70 | .Pp | |
71 | These files can grow rapidly on busy systems, daily or weekly rotation | |
72 | is recommended. | |
73 | If any of these files do not exist, it is not created. | |
74 | These | |
75 | files must be created manually and are normally maintained in either the script | |
76 | .Pa /etc/daily | |
77 | or the script | |
78 | .Pa /etc/weekly . | |
79 | (See | |
80 | .Xr cron 8 . ) | |
81 | .Bd -literal -offset indent | |
82 | #define _PATH_UTMP "/var/run/utmp" | |
83 | #define _PATH_WTMP "/var/log/wtmp" | |
84 | #define _PATH_LASTLOG "/var/log/lastlog" | |
85 | ||
86 | #define UT_NAMESIZE 8 | |
87 | #define UT_LINESIZE 8 | |
88 | #define UT_HOSTSIZE 16 | |
89 | ||
90 | struct lastlog { | |
91 | time_t ll_time; | |
92 | char ll_line[UT_LINESIZE]; | |
93 | char ll_host[UT_HOSTSIZE]; | |
94 | }; | |
95 | ||
96 | struct utmp { | |
97 | char ut_line[UT_LINESIZE]; | |
98 | char ut_name[UT_NAMESIZE]; | |
99 | char ut_host[UT_HOSTSIZE]; | |
100 | time_t ut_time; | |
101 | }; | |
102 | .Ed | |
103 | .Pp | |
104 | Each time a user logs in, the | |
105 | .Xr login | |
106 | program looks up the user's | |
107 | .Tn UID | |
108 | in the file | |
109 | .Nm lastlog. | |
110 | If it is found, the timestamp of the last time the user logged | |
111 | in, the terminal line and the hostname | |
112 | are written to the standard output. (Providing the login is not | |
113 | .Em quiet , | |
114 | see | |
115 | .Xr login 1 . ) | |
116 | The | |
117 | .Xr login | |
118 | program then records the new login time in the file | |
119 | .Nm lastlog . | |
120 | .Pp | |
121 | After the new | |
122 | .Fa lastlog | |
123 | record is written , | |
124 | .\" the | |
125 | .\" .Xr libutil 3 | |
126 | .\" routine | |
127 | the file | |
128 | .Nm utmp | |
129 | is opened and the | |
130 | .Fa utmp | |
131 | record for the user inserted. | |
132 | This record remains there until | |
133 | the user logs out at which time it is deleted. | |
134 | The | |
135 | .Nm utmp | |
136 | file is used by the programs | |
137 | .Xr rwho 1 , | |
138 | .Xr users 1 , | |
139 | .Xr w 1 , | |
140 | and | |
141 | .Xr who 1 . | |
142 | .Pp | |
143 | Next, the | |
144 | .Xr login | |
145 | program opens the file | |
146 | .Nm wtmp , | |
147 | and appends the user's | |
148 | .Fa utmp | |
149 | record. | |
150 | The same | |
151 | .Fa utmp | |
152 | record, with an updated time stamp is later appended | |
153 | to the file when the user logs out. (See | |
154 | .Xr launchd 8 . ) | |
155 | The | |
156 | .Nm wtmp | |
157 | file is used by the programs | |
158 | .Xr last 1 | |
159 | and | |
160 | .Xr ac 8 . | |
161 | .Pp | |
162 | In the event of a date change, a shutdown or reboot, the | |
163 | following items are logged in the | |
164 | .Nm wtmp | |
165 | file. | |
166 | .Pp | |
167 | .Bl -tag -width shutdownxx -compact | |
168 | .It Li reboot | |
169 | .It Li shutdown | |
170 | A system reboot or shutdown has been initiated. | |
171 | The character | |
172 | .Ql \&~ | |
173 | is placed in the field | |
174 | .Fa ut_line , | |
175 | and | |
176 | .Li reboot | |
177 | or | |
178 | .Li shutdown | |
179 | in the field | |
180 | .Fa ut_name . | |
181 | (See | |
182 | .Xr shutdown 8 | |
183 | and | |
184 | .Xr reboot 8 . ) | |
185 | .Pp | |
186 | .It Li date | |
187 | The system time has been manually or automatically updated. | |
188 | (See | |
189 | .Xr date 1 . ) | |
190 | The command name | |
191 | .Xr date | |
192 | is recorded in the field | |
193 | .Fa ut_name . | |
194 | In the field | |
195 | .Fa ut_line , | |
196 | the character | |
197 | .Ql \\*(Ba | |
198 | indicates the time prior to the change, and the character | |
199 | .Ql \&{ | |
200 | indicates the new time. | |
201 | .El | |
202 | .Sh FILES | |
203 | .Bf Sy | |
204 | (These files no longer exist in 10.5 or later.) | |
205 | .Ef | |
206 | .Pp | |
207 | .Bl -tag -width /var/log/lastlog -compact | |
208 | .It Pa /var/run/utmp | |
209 | The | |
210 | .Nm utmp file. | |
211 | .It Pa /var/log/wtmp | |
212 | The | |
213 | .Nm wtmp file. | |
214 | .It Pa /var/log/lastlog | |
215 | The | |
216 | .Nm lastlog file. | |
217 | .El | |
218 | .Sh SEE ALSO | |
219 | .Xr last 1 , | |
220 | .Xr login 1 , | |
221 | .Xr who 1 , | |
222 | .Xr ac 8 , | |
223 | .Xr launchd 8 | |
224 | .Sh HISTORY | |
225 | A | |
226 | .Nm utmp | |
227 | and | |
228 | .Nm wtmp | |
229 | file format appeared in | |
230 | .At v6 . | |
231 | The | |
232 | .Nm lastlog | |
233 | file format appeared in | |
234 | .Bx 3.0 . |