.\" Copyright (c) 1993 Michael Haardt (michael@cantor.informatik.rwth-aachen.de), Fri Apr 2 11:32:09 MET DST 1993 .\" .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License as .\" published by the Free Software Foundation; either version 2 of .\" the License, or (at your option) any later version. .\" .\" The GNU General Public License's references to "object code" .\" and "executables" are to be interpreted as the output of any .\" document formatting or typesetting system, including .\" intermediate and printed output. .\" .\" This manual is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public .\" License along with this manual; if not, write to the Free .\" Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, .\" USA. .\" .\" Modified Sun Jul 25 10:44:50 1993 by Rik Faith (faith@cs.unc.edu) .\" Modified Thu Feb 26 16:08:49 MET 1995 by Michael Haardt .TH UTMP 5 "February 26, 1995" "Linux" "Linux Programmer's Manual" .SH NAME utmp, wtmp \- login records .SH SYNOPSIS #include .SH DESCRIPTION The .B utmp file allows one to discover information about who is currently using the system. There may be more users currently using the system, because not all programs use utmp logging. \fBWarning:\fP \fButmp\fP must not be writable, because many system programs depend on its integrity. You risk faked system logfiles and modifications of system files if you leave \fButmp\fP writable to any user. The file is a sequence of entries with the following structure declared in the include file: .RS .nf .sp .ta 3i #define UT_UNKNOWN 0 #define RUN_LVL 1 #define BOOT_TIME 2 #define NEW_TIME 3 #define OLD_TIME 4 #define INIT_PROCESS 5 #define LOGIN_PROCESS 6 #define USER_PROCESS 7 #define DEAD_PROCESS 8 #define UT_LINESIZE 12 #define UT_NAMESIZE 8 #define UT_HOSTSIZE 16 struct utmp { short ut_type; /* type of login */ pid_t ut_pid; /* pid of process */ char ut_line[UT_LINESIZE]; /* device name of tty \- "/dev/" */ char ut_id[2]; /* init id or abbrev. ttyname */ time_t ut_time; /* login time */ char ut_user[UT_NAMESIZE]; /* user name */ char ut_host[UT_HOSTSIZE]; /* host name for remote login */ long ut_addr; /* IP addr of remote host */ }; .sp .fi .RE This structure gives the name of the special file associated with the user's terminal, the user's login name, and the time of login in the form of .IR time (2). String fields are terminated by \fB'\e0'\fP if they are shorter than the size of the field. .PP The \fBwtmp\fP file records all logins and logouts. Its format is exactly like \fButmp\fP except that a null user name indicates a logout on the associated terminal. Furthermore, the terminal name \fB"~"\fP with user name \fB"shutdown"\fP or \fB"reboot"\fP indicates a system shutdown or reboot and the pair of terminal names \fB"|"\fP/\fB"}"\fP logs the old/new system time when \fIdate\fP(1) changes it. \fBwtmp\fP is maintained by \fIlogin\fP(1), and \fIinit\fP(1) and some very of \fIgetty\fP(1). Neither of these programs creates the file, so if it is removed record-keeping is turned off. .SH FILES /var/adm/utmp .br /var/adm/wtmp .SH "CONFORMING TO" Linux utmp entries neither conform to v7/BSD nor to SYSV: They are a mix of the two. v7/BSD has less fields, most importantly it lacks \fBut_type\fP, which causes native v7/BSD-like programs to display for example dead or login entries. SYSV has one more field to log the exit status of dead processes. Linux uses the BSD conventions for line contents, as documented above. SYSV only uses the type field to mark them and logs informative messages such as e.g.\& \fB"new time"\fP in the line field. \fBUT_UNKNOWN\fP seems to be a Linux invention. There is no type \fBACCOUNTING\fP in Linux. SYSV has no \fBut_host\fP or \fBut_addr\fP fields. .SH RESTRICTIONS The file format is machine dependent, so it is recommended that it is processed only on the machine architecture where it got created. .SH "SEE ALSO" .BR ac (1), .BR date (1), .BR last (1), .BR login (1), .BR who (1), .BR getutent (3), .BR init (8)