updwtmp(3)

updwtmp3

Append an entry to the wtmp file

Usage

#include <utmp.h>

void updwtmp(const char *wtmp_path, const struct utmp *ut); void logwtmp(const char *line, const char *user, const char *host);

Library

System utilities library (libutil, -lutil)

Overview

updwtmp() appends the utmp structure ut to the wtmp file.

logwtmp() constructs a utmp structure using line, user, host, current time, and current process ID. Then it calls updwtmp() to append the structure to the wtmp file.

Files

/var/log/wtmp

database of past user logins

Attributes

For an explanation of the terms used in this section, see attributes(7).

InterfaceAttributeValue
updwtmp(), logwtmp()Thread safetyMT-Unsafe sig:ALRM timer

Versions

For consistency with the other "utmpx" functions (see getutxent(3)), glibc provides (since glibc 2.1):

#define _GNU_SOURCE          /* See feature_test_macros(7) */
#include <utmpx.h>
void updwtmpx (const char *wtmpx_path, const struct utmpx *utx);

This function performs the same task as updwtmp(), but differs in that it takes a utmpx structure as its last argument.

Releases

16 releases since Debian 2.0 (Hamm); the text changed 13 times.

  1. 2.0–2.2
  2. 3.0
  3. 3.1
  4. 4.0
  5. 5.0
  6. 6.0
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. Arch

Standards

None.

History

Solaris, NetBSD.

From man-pages 6.19-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.