UTMP(5)

NAME
utmp, wtmp - login records

SYNOPSIS
#include <utmp.h>

DESCRIPTION
The utmp file allows one to discover information about who is currently using the system. The file is a sequence of entries with the following structure declared in the include file:

    #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
    struct utmp {
      short ut_type;	/* type of login */
      pid_t ut_pid;		/* pid of process */
      char ut_line[12];	/* device name of tty -"/dev/" */
      char ut_id[2];	/* init id or abbrev. ttyname */
      time_t ut_time;	/* login time */
      char ut_user[8];	/* user name, not null-term */
      char ut_host[16];	/* host name for remote login */
      long ut_addr;	/* IP addr of remote host */
    };

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 time(2). String fields are terminated by \0 if they are short than the size of the field.

The wtmp file records all logins and logouts. Its format is exactly like utmp except that a null user name indicates a logout on the associated terminal. Furthermore, the terminal name ``~'' with user name ``shutdown'' or ``reboot'' indicates a system shutdown or reboot.

Wtmp is maintained by login(1), and init(1) and some very of getty(1). Neither of these programs creates the file, so if it is removed record-keeping is turned off.

FILES
/etc/utmp
/etc/wtmp

SEE ALSO
last(1), login(1), who(1)