1USERDBCTL(1) userdbctl USERDBCTL(1)
2
3
4
6 userdbctl - Inspect users, groups and group memberships
7
9 userdbctl [OPTIONS...] {COMMAND} [NAME...]
10
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
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
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
105 The userdbctl services command will list all currently running services
106 that provide user or group definitions to the system. The following are
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.Multiplexer
121 This service is provided by systemd-userdbd.service(8) and
122 multiplexes user/group look-ups to all other running lookup
123 services. This is the primary entry point for user/group record
124 clients, as it simplifies client side implementation substantially
125 since they can ask a single service for lookups instead of asking
126 all running services in parallel. userdbctl uses this service
127 preferably, too, unless --with-nss= or --service= are used, in
128 which case finer control over the services to talk to is required.
129
130 io.systemd.NameSeviceSwitch
131 This service is (also) provided by systemd-userdbd.service(8) and
132 converts classic NSS/glibc user and group records to JSON
133 user/group records, providing full backwards compatibility. Use
134 --with-nss=no to disable this compatibility, see above. Note that
135 compatibility is actually provided in both directions: nss-
136 systemd(8) will automatically synthesize classic NSS/glibc
137 user/group records from all JSON user/group records provided to the
138 system, thus using both APIs is mostly equivalent and provides
139 access to the same data, however the NSS/glibc APIs necessarily
140 expose a more reduced set of fields only.
141
142 Note that userdbctl has internal support for NSS-based lookups too.
143 This means that if neither io.systemd.Multiplexer nor
144 io.systemd.NameSeviceSwitch are running look-ups into the the basic
145 user/group databases will still work.
146
148 The userdbctl tool may be used to make the list of SSH authorized keys
149 possibly contained in a user record available to the SSH daemon for
150 authentication. For that configure the following in sshd_config(5):
151
152 ...
153 AuthorizedKeysCommand /usr/bin/userdbctl ssh-authorized-keys %u
154 AuthorizedKeysCommandUser root
155 ...
156
158 On success, 0 is returned, a non-zero failure code otherwise.
159
161 $SYSTEMD_PAGER
162 Pager to use when --no-pager is not given; overrides $PAGER. If
163 neither $SYSTEMD_PAGER nor $PAGER are set, a set of well-known
164 pager implementations are tried in turn, including less(1) and
165 more(1), until one is found. If no pager implementation is
166 discovered no pager is invoked. Setting this environment variable
167 to an empty string or the value "cat" is equivalent to passing
168 --no-pager.
169
170 $SYSTEMD_LESS
171 Override the options passed to less (by default "FRSXMK").
172
173 Users might want to change two options in particular:
174
175 K
176 This option instructs the pager to exit immediately when Ctrl+C
177 is pressed. To allow less to handle Ctrl+C itself to switch
178 back to the pager command prompt, unset this option.
179
180 If the value of $SYSTEMD_LESS does not include "K", and the
181 pager that is invoked is less, Ctrl+C will be ignored by the
182 executable, and needs to be handled by the pager.
183
184 X
185 This option instructs the pager to not send termcap
186 initialization and deinitialization strings to the terminal. It
187 is set by default to allow command output to remain visible in
188 the terminal even after the pager exits. Nevertheless, this
189 prevents some pager functionality from working, in particular
190 paged output cannot be scrolled with the mouse.
191
192 See less(1) for more discussion.
193
194 $SYSTEMD_LESSCHARSET
195 Override the charset passed to less (by default "utf-8", if the
196 invoking terminal is determined to be UTF-8 compatible).
197
198 $SYSTEMD_COLORS
199 The value must be a boolean. Controls whether colorized output
200 should be generated. This can be specified to override the decision
201 that systemd makes based on $TERM and what the console is connected
202 to.
203
204 $SYSTEMD_URLIFY
205 The value must be a boolean. Controls whether clickable links
206 should be generated in the output for terminal emulators supporting
207 this. This can be specified to override the decision that systemd
208 makes based on $TERM and other conditions.
209
211 systemd(1), systemd-userdbd.service(8), systemd-homed.service(8), nss-
212 systemd(8), getent(1)
213
215 1. JSON User Record
216 https://systemd.io/USER_RECORD
217
218 2. JSON Group Record
219 https://systemd.io/GROUP_RECORD
220
221 3. User/Group Record Lookup API via Varlink
222 https://systemd.io/USER_GROUP_API
223
224
225
226systemd 245 USERDBCTL(1)