43 lines
1.6 KiB
Diff
43 lines
1.6 KiB
Diff
From 0a7c3f3ba3c2424718fadf99bf2ed5851f22f6bb Mon Sep 17 00:00:00 2001
|
|
From: Andreas Schneider <asn@cryptomilk.org>
|
|
Date: Wed, 5 Feb 2025 15:38:32 +0100
|
|
Subject: [PATCH] docs: Add an examples for command line access
|
|
|
|
It took me almost an hour to read through the source code to construct
|
|
this line.
|
|
|
|
(cherry picked from commit 20634844ddfc55eebbd6696919f043e3272881c2)
|
|
---
|
|
docs/USER_GROUP_API.md | 21 +++++++++++++++++++++
|
|
1 file changed, 21 insertions(+)
|
|
|
|
diff --git a/docs/USER_GROUP_API.md b/docs/USER_GROUP_API.md
|
|
index d0016dbc2d..033c2a1b98 100644
|
|
--- a/docs/USER_GROUP_API.md
|
|
+++ b/docs/USER_GROUP_API.md
|
|
@@ -270,3 +270,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"}'
|
|
+```
|