1 .\" Copyright (c) 1980, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the University nor the names of its contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" @(#)utmp.5 8.2 (Berkeley) 3/17/94
29 .\" $FreeBSD: src/share/man/man5/utmp.5,v 1.9.2.8 2001/12/17 11:30:15 ru Exp $
30 .\" $DragonFly: src/share/man/man5/utmp.5,v 1.3 2006/05/26 19:39:40 swildner Exp $
46 declares the structures used to record information about current
49 logins and logouts in the file
51 and last logins in the file
53 The time stamps of date changes, shutdowns and reboots are also logged in
57 .Bd -literal -offset indent
58 #define _PATH_UTMP "/var/run/utmp"
59 #define _PATH_WTMP "/var/log/wtmp"
60 #define _PATH_LASTLOG "/var/log/lastlog"
62 #define UT_NAMESIZE 16
64 #define UT_HOSTSIZE 16
67 time_t ll_time; /* When user logged in */
68 char ll_line[UT_LINESIZE]; /* Terminal line name */
69 char ll_host[UT_HOSTSIZE]; /* Host user came from */
73 char ut_line[UT_LINESIZE]; /* Terminal line name */
74 char ut_name[UT_NAMESIZE]; /* User's login name */
75 char ut_host[UT_HOSTSIZE]; /* Host user came from */
76 time_t ut_time; /* When user logged in */
82 file is a linear array of
84 structures indexed by a user's
88 file is a linear array of
90 structures indexed by a terminal line number
97 structures and is a binary log file,
98 that is, grows linearly at its end.
100 Each time a user logs in, the
102 program looks up the user's
106 If it is found, the timestamp of the last time the user logged
107 in, the terminal line and the hostname
108 are written to the standard output (unless the login is
114 program then records the new login time in the file
127 record for the user is inserted.
128 This record remains there until
129 the user logs out at which time it is deleted.
132 file is used by the programs
141 program opens the file
143 and appends the user's
146 The user's subsequent logout from the terminal
147 line is marked by a special
162 file is used by the programs
167 In the event of a date change, a shutdown or reboot, the
168 following items are logged in the
172 .Bl -tag -width ".Li shutdown" -compact
175 A system reboot or shutdown has been initiated.
178 is placed in the field
192 The system time has been manually or automatically updated
197 is recorded in the field
203 indicates the time prior to the change, and the character
205 indicates the new time.
210 file can grow rapidly on busy systems, so daily or weekly rotation
215 If any one of these files does not exist, it is not created by
217 They must be created manually.
224 utility functions should be used to perform
225 the standard actions on the
229 files in order to maintain the portability across
230 systems with different formats of those files.
232 .Bl -tag -width ".Pa /var/log/lastlog" -compact
241 .It Pa /var/log/lastlog
262 file format appeared in
266 file format appeared in