On Mon, 13 Sep 2021 at 22:59:32 +0200, Aurelien Jarno wrote: > - running the operation on a non-existing user, but as loginctl does a > check that the user exists, it has to be done directly with the dbus > API, for instance "gdbus call --system --dest org.freedesktop.login1 > --object-path /org/freedesktop/login1 --method > org.freedesktop.login1.Manager.SetUserLinger 12345678 true true" > > The latest is more a bit more complex to do (especially that > libglib2.0-bin is not necessarily installed on the system), but has the > advantage of exercising all configured NSS modules.
systemd happens to have its own D-Bus implementation sd-bus (a competitor to libdbus and GLib's GDBus) for which it provides busctl(1), an equivalent of gdbus(1) and dbus-send(1). So this could be written as: busctl call --system org.freedesktop.login1 /org/freedesktop/login1 \ org.freedesktop.login1.Manager SetUserLinger ubb $uid true true which does not have dependencies outside systemd.deb. The nonexistent uid should probably be in one of the ranges reserved by Policy ยง9.2.2: perhaps 4294967294 or (uint32_t) -2, which is reserved as a representation of the anonymous NFS user? smcv