S6-LINUX-INIT-LOGOUTHOOKD(8)

NAME
s6-linux-init-logouthookd - clean up client's utmp record when it dies

SYNOPSIS
s6-ipcserver socket s6-linux-init-logouthookd

DESCRIPTION
s6-linux-init-logouthookd cleans up its client's utmp record when it dies.

s6-linux-init-logouthookd implements an s6-local-service(7) for getty programs that add a utmp record when a user logs in.

In the sysvinit model, getty / login and similar programs add a utmp record for every user that logs in, then exec(3) into the user's shell. At logout time, the shell dies; sysvinit is supervising the getty program, so it's watching the pid, and respawns the getty when the shell dies. But before respawning the getty, it cleans up the utmp record, to correctly report that the user isn't logged in on this terminal anymore.

utmp is an old, clunky, insecure system ( unless you're using utmps[1]) and it is definitely not pid 1's job to have any knowledge of utmp and play janitor after getty. s6-svscan(8) will definitely not do it.

Some distributions use versions of login(1) that fork the user's shell instead of exec(3) ing it. When the user logs out, the login(1) program cleans up after itself. This is a better model, but it's not always easy to patch login(1) to go from an “exec the shell” model to a “fork the shell as a child” model.

s6-linux-init comes with a small library which makes it easy for a distribution to fully support utmp cleanup with an s6 init system if they so choose. Before exec(3) ing into the user's shell, the login(1) program should just make a call to s6_linux_init_logouthook(), and that's it. That function will call the ‘s6-linux-init-logouthookd’ s6-local-service(7), which will do nothing but wait until the user's shell dies; and when it happens, the user's utmp record will automatically be cleaned up.

The s6-local-service(7) implementing logouthook support is automatically created at boot time when the -L option has been given to s6-linux-init-maker(8). Client-side, though, the various login programs must be patched at the source level.

EXIT STATUS
s6-linux-init-logouthookd' s exit code does not matter, because no program uses it. However, here's the list for completeness:

0   Success, whether or not there was a utmp record to clean up.

1   Connection attempt from a non-root user.

2   Write attempt from a ( misprogrammed) client.

111 System call failed.

SEE ALSO
s6-linux-init-echo(1), s6-linux-init-overview(7), s6-linux-init-quickstart(7), s6-linux-init-why(7), s6-linux-init(8), s6-linux-init-hpr(8), s6-linux-init-maker(8), s6-linux-init-nuke(8), s6-linux-init-shutdown(8), s6-linux-init-shutdownd(8), s6-linux-init-telinit(8), s6-linux-init-umountall(8)

[1] https://skarnet.org/software/utmps/

This man page is ported from the authoritative documentation at: https://skarnet.org/software/s6-linux-init/s6-linux-init-logouthookd.html

AUTHORS
Laurent Bercot Alexis <flexibeast@gmail.com> (man page port)