Debian Codegraph @

upstream/debian-trixie/man8/nss-systemd.8

raw
1 '\" t
2 .TH "NSS\-SYSTEMD" "8" "" "systemd 257.13" "nss-systemd"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 nss-systemd, libnss_systemd.so.2 \- UNIX user and group name resolution for user/group lookup via Varlink
24 .SH "SYNOPSIS"
25 .PP
26 libnss_systemd\&.so\&.2
27 .SH "DESCRIPTION"
28 .PP
29 \fBnss\-systemd\fR
30 is a plug\-in module for the GNU Name Service Switch (NSS) functionality of the GNU C Library (\fBglibc\fR), providing UNIX user and group name resolution for services implementing the
31 \m[blue]\fBUser/Group Record Lookup API via Varlink\fR\m[]\&\s-2\u[1]\d\s+2, such as the system and service manager
32 \fBsystemd\fR(1)
33 (for its
34 \fIDynamicUser=\fR
35 feature, see
36 \fBsystemd.exec\fR(5)
37 for details),
38 \fBsystemd-homed.service\fR(8), or
39 \fBsystemd-machined.service\fR(8)\&.
40 .PP
41 This module also ensures that the root and nobody users and groups (i\&.e\&. the users/groups with the UIDs/GIDs 0 and 65534) remain resolvable at all times, even if they are not listed in
42 /etc/passwd
43 or
44 /etc/group, or if these files are missing\&.
45 .PP
46 This module preferably utilizes
47 \fBsystemd-userdbd.service\fR(8)
48 for resolving users and groups, but also works without the service running\&.
49 .PP
50 To activate the NSS module, add
51 "systemd"
52 to the lines starting with
53 "passwd:",
54 "group:",
55 "shadow:"
56 and
57 "gshadow:"
58 in
59 /etc/nsswitch\&.conf\&.
60 .PP
61 It is recommended to place
62 "systemd"
63 after the
64 "files"
65 entry of the
66 /etc/nsswitch\&.conf
67 lines so that
68 /etc/passwd,
69 /etc/group,
70 /etc/shadow
71 and
72 /etc/gshadow
73 based mappings take precedence\&.
74 .SH "STATIC DROP\-IN JSON USER/GROUP RECORDS"
75 .PP
76 Besides user/group records acquired via the aforementioned Varlink IPC interfaces and the synthesized root and nobody accounts, this module also makes user and group accounts available to the system that are defined in static drop\-in files in the
77 /etc/userdb/,
78 /run/userdb/,
79 /run/host/userdb/
80 and
81 /usr/lib/userdb/
82 directories\&.
83 .PP
84 This is a simple mechanism to provide static user and group records via JSON drop\-in files\&. Such user records should be defined in the format described by the
85 \m[blue]\fBJSON User Records\fR\m[]\&\s-2\u[2]\d\s+2
86 specification and be placed in one of the aforementioned directories under a file name composed of the user name suffixed with
87 \&.user, with a world\-readable access mode\&. A symlink named after the user record\*(Aqs UID formatted in decimal and suffixed with
88 \&.user
89 pointing to the primary record file should be created as well, in order to allow both lookups by username and by UID\&. Privileged user record data (e\&.g\&. hashed UNIX passwords) may optionally be provided as well, in a pair of separate companion files with the
90 \&.user\-privileged
91 suffix\&. The data should be stored in a regular file named after the user name, suffixed with
92 \&.user\-privileged, and a symlink pointing to it, named after the used numeric UID formatted in decimal with the same suffix\&. These companion files should not be readable to anyone but root\&. Example:
93 .sp
94 .if n \{\
95 .RS 4
96 .\}
97 .nf
98 \-rw\-r\-\-r\-\-\&. 1 root root 723 May 10 foobar\&.user
99 \-rw\-\-\-\-\-\-\-\&. 1 root root 123 May 10 foobar\&.user\-privileged
100 lrwxrwxrwx\&. 1 root root 19 May 10 4711\&.user \-> foobar\&.user
101 lrwxrwxrwx\&. 1 root root 19 May 10 4711\&.user\-privileged \-> foobar\&.user\-privileged
102 .fi
103 .if n \{\
104 .RE
105 .\}
106 .PP
107 Similarly, group records following the format described in
108 \m[blue]\fBJSON Group Record\fR\m[]\&\s-2\u[3]\d\s+2
109 may be defined, using the file suffixes
110 \&.group
111 and
112 \&.group\-privileged\&.
113 .PP
114 The primary user/group record files (i\&.e\&. those with the
115 \&.user
116 and
117 \&.group
118 suffixes) should not contain the
119 "privileged"
120 section as described in the specifications\&. The privileged user/group record files (i\&.e\&. those with the
121 \&.user\-privileged
122 and
123 \&.group\-privileged
124 suffixes) should contain this section, exclusively\&.
125 .PP
126 In addition to the two types of user record files and the two types of group record files there\*(Aqs a fifth type of file that may be placed in the searched directories: files that indicate membership of users in groups\&. Specifically, for every pair of user/group where the user shall be a member of a group a file named
127 "\fIusername\fR:\fIgroupname\fR\&.membership"
128 should be created, i\&.e\&. the textual UNIX user name, followed by a colon, followed by the textual UNIX group name, suffixed by
129 "\&.membership"\&. The contents of these files are currently not read, and the files should be created empty\&. The mere existence of these files is enough to affect a user/group membership\&. If a program provides user and/or group record files in the searched directories, it should always also create such files, both for primary and auxiliary group memberships\&.
130 .PP
131 Note that static user/group records generally do not override conflicting records in
132 /etc/passwd
133 or
134 /etc/group
135 or other account databases\&. In fact, before dropping in these files a reasonable level of care should be taken to avoid user/group name and UID/GID conflicts\&.
136 .SH "CONFIGURATION IN /ETC/NSSWITCH\&.CONF"
137 .PP
138 Here is an example
139 /etc/nsswitch\&.conf
140 file that enables
141 \fBnss\-systemd\fR
142 correctly:
143 .sp
144 .if n \{\
145 .RS 4
146 .\}
147 .nf
148 passwd: files \fBsystemd\fR
149 group: files \fB[SUCCESS=merge] systemd\fR
150 shadow: files \fBsystemd\fR
151 gshadow: files \fBsystemd\fR
152
153 hosts: mymachines resolve [!UNAVAIL=return] files myhostname dns
154 networks: files
155
156 protocols: db files
157 services: db files
158 ethers: db files
159 rpc: db files
160
161 netgroup: nis
162 .fi
163 .if n \{\
164 .RE
165 .\}
166 .SH "EXAMPLE: MAPPINGS PROVIDED BY SYSTEMD\-MACHINED\&.SERVICE"
167 .PP
168 The container
169 "rawhide"
170 is spawned using
171 \fBsystemd-nspawn\fR(1):
172 .sp
173 .if n \{\
174 .RS 4
175 .\}
176 .nf
177 # systemd\-nspawn \-M rawhide \-\-boot \-\-network\-veth \-\-private\-users=pick
178 Spawning container rawhide on /var/lib/machines/rawhide\&.
179 Selected user namespace base 20119552 and range 65536\&.
180 \&.\&.\&.
181
182 $ machinectl \-\-max\-addresses=3
183 MACHINE CLASS SERVICE OS VERSION ADDRESSES
184 rawhide container systemd\-nspawn fedora 30 169\&.254\&.40\&.164 fe80::94aa:3aff:fe7b:d4b9
185
186 $ getent passwd vu\-rawhide\-0 vu\-rawhide\-81
187 vu\-rawhide\-0:*:20119552:65534:vu\-rawhide\-0:/:/usr/sbin/nologin
188 vu\-rawhide\-81:*:20119633:65534:vu\-rawhide\-81:/:/usr/sbin/nologin
189
190 $ getent group vg\-rawhide\-0 vg\-rawhide\-81
191 vg\-rawhide\-0:*:20119552:
192 vg\-rawhide\-81:*:20119633:
193
194 $ ps \-o user:15,pid,tty,command \-e|grep \*(Aq^vu\-rawhide\*(Aq
195 vu\-rawhide\-0 692 ? /usr/lib/systemd/systemd
196 vu\-rawhide\-0 731 ? /usr/lib/systemd/systemd\-journald
197 vu\-rawhide\-192 734 ? /usr/lib/systemd/systemd\-networkd
198 vu\-rawhide\-193 738 ? /usr/lib/systemd/systemd\-resolved
199 vu\-rawhide\-0 742 ? /usr/lib/systemd/systemd\-logind
200 vu\-rawhide\-81 744 ? /usr/bin/dbus\-daemon \-\-system \-\-address=systemd: \-\-nofork \-\-nopidfile \-\-systemd\-activation \-\-syslog\-only
201 vu\-rawhide\-0 746 ? /usr/sbin/sshd \-D \&.\&.\&.
202 vu\-rawhide\-0 752 ? /usr/lib/systemd/systemd \-\-user
203 vu\-rawhide\-0 753 ? (sd\-pam)
204 vu\-rawhide\-0 1628 ? login \-\- zbyszek
205 vu\-rawhide\-1000 1630 ? /usr/lib/systemd/systemd \-\-user
206 vu\-rawhide\-1000 1631 ? (sd\-pam)
207 vu\-rawhide\-1000 1637 pts/8 \-zsh
208 .fi
209 .if n \{\
210 .RE
211 .\}
212 .SH "SEE ALSO"
213 .PP
214 \fBsystemd\fR(1), \fBsystemd.exec\fR(5), \fBnss-resolve\fR(8), \fBnss-myhostname\fR(8), \fBnss-mymachines\fR(8), \fBsystemd-userdbd.service\fR(8), \fBsystemd-homed.service\fR(8), \fBsystemd-machined.service\fR(8), \fBnsswitch.conf\fR(5), \fBgetent\fR(1)
215 .SH "NOTES"
216 .IP " 1." 4
217 User/Group Record Lookup API via Varlink
218 .RS 4
219 \%https://systemd.io/USER_GROUP_API
220 .RE
221 .IP " 2." 4
222 JSON User Records
223 .RS 4
224 \%https://systemd.io/USER_RECORD
225 .RE
226 .IP " 3." 4
227 JSON Group Record
228 .RS 4
229 \%https://systemd.io/GROUP_RECORD
230 .RE