]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
docs: Add an examples for command line access
authorAndreas Schneider <asn@cryptomilk.org>
Wed, 5 Feb 2025 14:38:32 +0000 (15:38 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 6 Feb 2025 12:38:34 +0000 (13:38 +0100)
It took me almost an hour to read through the source code to construct
this line.

docs/USER_GROUP_API.md

index fdb7b6568c61fe0a719b2fbf8913ef5a8c362fb6..1109ad81da7d378be2a33865b94b47f6f27310e4 100644 (file)
@@ -323,3 +323,24 @@ result in more than one reply, because neither UID/GID nor name is specified) is
 Services which are asked for enumeration may return the `EnumerationNotSupported` error in this case.
 
 And that's really all there is to it.
+
+## Command Line Access
+
+For command line access you can use the
+[userdbctl](https://www.freedesktop.org/software/systemd/man/latest/userdbctl.html)
+or
+[varlinkctl](https://www.freedesktop.org/software/systemd/man/latest/varlinkctl.html)
+commands. The `userdbctl` command is more end user friendly and the `varlinkctl`
+command can help developers to understand the user database better.
+
+To figure out which methods in the user database are available you can use:
+
+```sh
+varlinkctl introspect /run/systemd/userdb/io.systemd.Multiplexer io.systemd.UserDatabase
+```
+
+To get a record for a specific user use:
+
+```sh
+varlinkctl call /run/systemd/userdb/io.systemd.Multiplexer io.systemd.UserDatabase.GetUserRecord '{"userName": "alice", "service": "io.systemd.Multiplexer"}'
+```