1USERDBCTL(1)                       userdbctl                      USERDBCTL(1)
2
3
4

NAME

6       userdbctl - Inspect users, groups and group memberships
7

SYNOPSIS

9       userdbctl [OPTIONS...] {COMMAND} [NAME...]
10

DESCRIPTION

12       userdbctl may be used to inspect user and groups (as well as group
13       memberships) of the system. This client utility inquires user/group
14       information provided by various system services, both operating on JSON
15       user/group records (as defined by the JSON User Record[1] and JSON
16       Group Record[2] definitions), and classic UNIX NSS/glibc user and group
17       records. This tool is primarily a client to the User/Group Record
18       Lookup API via Varlink[3].
19

OPTIONS

21       The following options are understood:
22
23       --output=MODE
24           Choose the output mode, takes one of "classic", "friendly",
25           "table", "json". If "classic", an output very close to the format
26           of /etc/passwd or /etc/group is generated. If "friendly" a more
27           comprehensive and user friendly, human readable output is
28           generated; if "table" a minimal, tabular output is generated; if
29           "json" a JSON formatted output is generated. Defaults to "friendly"
30           if a user/group is specified on the command line, "table"
31           otherwise.
32
33       --service=SERVICE[:SERVICE...], -s SERVICE:SERVICE...
34           Controls which services to query for users/groups. Takes a list of
35           one or more service names, separated by ":". See below for a list
36           of well-known service names. If not specified all available
37           services are queried at once.
38
39       --with-nss=BOOL
40           Controls whether to include classic glibc/NSS user/group lookups in
41           the output. If --with-nss=no is used any attempts to resolve or
42           enumerate users/groups provided only via glibc NSS is suppressed.
43           If --with-nss=yes is specified such users/groups are included in
44           the output (which is the default).
45
46       --synthesize=BOOL
47           Controls whether to synthesize records for the root and nobody
48           users/groups if they aren't defined otherwise. By default (or
49           "yes") such records are implicitly synthesized if otherwise missing
50           since they have special significance to the OS. When "no" this
51           synthesizing is turned off.
52
53       -N
54           This option is short for --with-nss=no --synthesize=no. Use this
55           option to show only records that are natively defined as JSON user
56           or group records, with all NSS/glibc compatibility and all implicit
57           synthesis turned off.
58
59       --no-pager
60           Do not pipe output into a pager.
61
62       --no-legend
63           Do not print the legend, i.e. column headers and the footer with
64           hints.
65
66       -h, --help
67           Print a short help text and exit.
68
69       --version
70           Print a short version string and exit.
71

COMMANDS

73       The following commands are understood:
74
75       user [USER...]
76           List all known users records or show details of one or more
77           specified user records. Use --output= to tweak output mode.
78
79       group [GROUP...]
80           List all known group records or show details of one or more
81           specified group records. Use --output= to tweak output mode.
82
83       users-in-group [GROUP...]
84           List users that are members of the specified groups. If no groups
85           are specified list all user/group memberships defined. Use
86           --output= to tweak output mode.
87
88       groups-of-user [USER...]
89           List groups that the specified users are members of. If no users
90           are specified list all user/group memberships defined (in this case
91           groups-of-user and users-in-group are equivalent). Use --output= to
92           tweak output mode.
93
94       services
95           List all services currently providing user/group definitions to the
96           system. See below for a list of well-known services providing user
97           information.
98
99       ssh-authorized-keys
100           This operation is not a public, user-facing interface. It is used
101           to allow the SSH daemon to pick up authorized keys from user
102           records, see below.
103

WELL-KNOWN SERVICES

105       The userdbctl services command will list all currently running services
106       that provide user or group definitions to the system. The following
107       well-known services are shown among this list:
108
109       io.systemd.DynamicUser
110           This service is provided by the system service manager itself (i.e.
111           PID 1) and makes all users (and their groups) synthesized through
112           the DynamicUser= setting in service unit files available to the
113           system (see systemd.exec(5) for details about this setting).
114
115       io.systemd.Home
116           This service is provided by systemd-homed.service(8) and makes all
117           users (and their groups) belonging to home directories managed by
118           that service available to the system.
119
120       io.systemd.Machine
121           This service is provided by systemd-machined.service(8) and
122           synthesizes records for all users/groups used by a container that
123           employs user namespacing.
124
125       io.systemd.Multiplexer
126           This service is provided by systemd-userdbd.service(8) and
127           multiplexes user/group look-ups to all other running lookup
128           services. This is the primary entry point for user/group record
129           clients, as it simplifies client side implementation substantially
130           since they can ask a single service for lookups instead of asking
131           all running services in parallel.  userdbctl uses this service
132           preferably, too, unless --with-nss= or --service= are used, in
133           which case finer control over the services to talk to is required.
134
135       io.systemd.NameSeviceSwitch
136           This service is (also) provided by systemd-userdbd.service(8) and
137           converts classic NSS/glibc user and group records to JSON
138           user/group records, providing full backwards compatibility. Use
139           --with-nss=no to disable this compatibility, see above. Note that
140           compatibility is actually provided in both directions: nss-
141           systemd(8) will automatically synthesize classic NSS/glibc
142           user/group records from all JSON user/group records provided to the
143           system, thus using both APIs is mostly equivalent and provides
144           access to the same data, however the NSS/glibc APIs necessarily
145           expose a more reduced set of fields only.
146
147       Note that userdbctl has internal support for NSS-based lookups too.
148       This means that if neither io.systemd.Multiplexer nor
149       io.systemd.NameSeviceSwitch are running look-ups into the basic
150       user/group databases will still work.
151

INTEGRATION WITH SSH

153       The userdbctl tool may be used to make the list of SSH authorized keys
154       possibly contained in a user record available to the SSH daemon for
155       authentication. For that configure the following in sshd_config(5):
156
157           ...
158           AuthorizedKeysCommand /usr/bin/userdbctl ssh-authorized-keys %u
159           AuthorizedKeysCommandUser root
160           ...
161

EXIT STATUS

163       On success, 0 is returned, a non-zero failure code otherwise.
164

ENVIRONMENT

166       $SYSTEMD_PAGER
167           Pager to use when --no-pager is not given; overrides $PAGER. If
168           neither $SYSTEMD_PAGER nor $PAGER are set, a set of well-known
169           pager implementations are tried in turn, including less(1) and
170           more(1), until one is found. If no pager implementation is
171           discovered no pager is invoked. Setting this environment variable
172           to an empty string or the value "cat" is equivalent to passing
173           --no-pager.
174
175       $SYSTEMD_LESS
176           Override the options passed to less (by default "FRSXMK").
177
178           Users might want to change two options in particular:
179
180           K
181               This option instructs the pager to exit immediately when Ctrl+C
182               is pressed. To allow less to handle Ctrl+C itself to switch
183               back to the pager command prompt, unset this option.
184
185               If the value of $SYSTEMD_LESS does not include "K", and the
186               pager that is invoked is less, Ctrl+C will be ignored by the
187               executable, and needs to be handled by the pager.
188
189           X
190               This option instructs the pager to not send termcap
191               initialization and deinitialization strings to the terminal. It
192               is set by default to allow command output to remain visible in
193               the terminal even after the pager exits. Nevertheless, this
194               prevents some pager functionality from working, in particular
195               paged output cannot be scrolled with the mouse.
196
197           See less(1) for more discussion.
198
199       $SYSTEMD_LESSCHARSET
200           Override the charset passed to less (by default "utf-8", if the
201           invoking terminal is determined to be UTF-8 compatible).
202
203       $SYSTEMD_PAGERSECURE
204           Takes a boolean argument. When true, the "secure" mode of the pager
205           is enabled; if false, disabled. If $SYSTEMD_PAGERSECURE is not set
206           at all, secure mode is enabled if the effective UID is not the same
207           as the owner of the login session, see geteuid(2) and
208           sd_pid_get_owner_uid(3). In secure mode, LESSSECURE=1 will be set
209           when invoking the pager, and the pager shall disable commands that
210           open or create new files or start new subprocesses. When
211           $SYSTEMD_PAGERSECURE is not set at all, pagers which are not known
212           to implement secure mode will not be used. (Currently only less(1)
213           implements secure mode.)
214
215           Note: when commands are invoked with elevated privileges, for
216           example under sudo(8) or pkexec(1), care must be taken to ensure
217           that unintended interactive features are not enabled. "Secure" mode
218           for the pager may be enabled automatically as describe above.
219           Setting SYSTEMD_PAGERSECURE=0 or not removing it from the inherited
220           environment allows the user to invoke arbitrary commands. Note that
221           if the $SYSTEMD_PAGER or $PAGER variables are to be honoured,
222           $SYSTEMD_PAGERSECURE must be set too. It might be reasonable to
223           completly disable the pager using --no-pager instead.
224
225       $SYSTEMD_COLORS
226           The value must be a boolean. Controls whether colorized output
227           should be generated. This can be specified to override the decision
228           that systemd makes based on $TERM and what the console is connected
229           to.
230
231       $SYSTEMD_URLIFY
232           The value must be a boolean. Controls whether clickable links
233           should be generated in the output for terminal emulators supporting
234           this. This can be specified to override the decision that systemd
235           makes based on $TERM and other conditions.
236

SEE ALSO

238       systemd(1), systemd-userdbd.service(8), systemd-homed.service(8), nss-
239       systemd(8), getent(1)
240

NOTES

242        1. JSON User Record
243           https://systemd.io/USER_RECORD
244
245        2. JSON Group Record
246           https://systemd.io/GROUP_RECORD
247
248        3. User/Group Record Lookup API via Varlink
249           https://systemd.io/USER_GROUP_API
250
251
252
253systemd 246                                                       USERDBCTL(1)
Impressum