utmps
Software
skarnet.org

# The utmps-wtmpd program

utmps-wtmpd manages the wtmp database. It expects to be able to create, read and modify a file named `wtmp` in the directory it is launched in.

It is not meant to be called directly; instead, it is expected to be run from a script as a part of a "wtmpd" local service.

The `examples/` subdirectory of the utmps package provides examples on how to run such a service. The simplest way to do so, for testing purposes, is a command line such as:

    s6-ipcserver .wtmpd-socket utmps-wtmpd wtmp

while being in the `/run/utmps` directory.

`/run/utmps/.wtmpd-socket` is the default place where utmps's implementation of the `updwtmpx()` function expects the wtmpd service to be. It can be changed at build time by giving the `--with-wtmp-socket=PATH` option to configure.

utmps-wtmpd does not listen to the socket itself: it reads from its standard input and writes to its standard output. It relies on a superserver such as s6-ipcserver to manage connections to the socket. An instance of utmps-wtmpd is run for every client connection; every instance reads the effective uid of the client in an environment variable set by the superserver, which allows it to filter operations: only lines whose `ut_user` field resolves to the effective uid of the client will be appended to the database.

If more fine-grained authorizations are required (only allowing certain users and groups to connect to the service), the superserver can be configured to enforce them. For instance, it is possible to tell s6-ipcserver to only accept connections from root.

utmps-wtmpd does not need to run as root, provided it can write its file; it is recommended to create a utmp user and group, dedicated to utmps-wtmpd and utmps-utmpd operation, and run the superserver as this user and group.

If no argument is given to utmps-wtmpd, wtmp logs will be added to the `wtmp` file in utmps-wtmpd's working directory. If an argument is given, wtmp logs will be added to that file instead.