summaryrefslogtreecommitdiff
path: root/doc/utmps-wtmpd.html
blob: 898899fe51c55f9e09868d891ba6ad21193849f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="Content-Language" content="en" />
    <title>utmps: the utmps-wtmpd program</title>
    <meta name="Description" content="utmps: the utmps-wtmpd program" />
    <meta name="Keywords" content="utmps wtmp wtmpd daemon service utmps-wtmpd" />
    <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
  </head>
<body>

<p>
<a href="index.html">utmps</a><br />
<a href="//skarnet.org/software/">Software</a><br />
<a href="//skarnet.org/">skarnet.org</a>
</p>

<h1> The utmps-wtmpd program </h1>

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

<p>
 It is not meant to be called directly; instead, it is expected to be run from
a script as a part of a "wtmpd"
<a href="//skarnet.org/software/s6/localservice.html">local service</a>.
</p>

<p>
 The <tt>examples/</tt> 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:
</p>
<pre>s6-ipcserver .wtmpd-socket utmps-wtmpd wtmp</pre>
<p>
 while being in the <tt>/run/utmps</tt> directory.
</p>

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

<p>
 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
<a href="//skarnet.org/software/s6/s6-ipcserver.html">s6-ipcserver</a>
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 <tt>ut_user</tt> field resolves to the effective uid of
the client will be appended to the database.
</p>

<p>
 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.
</p>

<p>
 utmps-wtmpd does not need to run as root, provided it can write its file;
it is recommended to create a <em>utmp</em> user and group, dedicated to
utmps-wtmpd and
<a href="utmps-utmpd.html">utmps-utmpd</a> operation, and run the
superserver as this user and group.
</p>

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

</body>
</html>