]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/nss-systemd.xml
userdbd: also listen on a varlink socket io.systemd.DropIn
[thirdparty/systemd.git] / man / nss-systemd.xml
CommitLineData
409093fe 1<?xml version='1.0'?> <!--*-nxml-*-->
3a54a157 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
409093fe 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
db9ecf05 4<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
409093fe 5
e7e11bbf 6<refentry id="nss-systemd" conditional='ENABLE_NSS_SYSTEMD'>
409093fe
LP
7
8 <refentryinfo>
9 <title>nss-systemd</title>
10 <productname>systemd</productname>
409093fe
LP
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>nss-systemd</refentrytitle>
15 <manvolnum>8</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>nss-systemd</refname>
20 <refname>libnss_systemd.so.2</refname>
e9dd6984 21 <refpurpose>UNIX user and group name resolution for user/group lookup via Varlink</refpurpose>
409093fe
LP
22 </refnamediv>
23
24 <refsynopsisdiv>
25 <para><filename>libnss_systemd.so.2</filename></para>
26 </refsynopsisdiv>
27
28 <refsect1>
29 <title>Description</title>
30
0ba56d36
LP
31 <para><command>nss-systemd</command> is a plug-in module for the GNU Name Service Switch (NSS)
32 functionality of the GNU C Library (<command>glibc</command>), providing UNIX user and group name
33 resolution for services implementing the <ulink url="https://systemd.io/USER_GROUP_API">User/Group Record
34 Lookup API via Varlink</ulink>, such as the system and service manager
35 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry> (for its
36 <varname>DynamicUser=</varname> feature, see
37 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry> for
4c2cf157
LP
38 details),
39 <citerefentry><refentrytitle>systemd-homed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, or <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
409093fe 40
2129011e
LP
41 <para>This module also ensures that the root and nobody users and groups (i.e. the users/groups with the UIDs/GIDs
42 0 and 65534) remain resolvable at all times, even if they aren't listed in <filename>/etc/passwd</filename> or
43 <filename>/etc/group</filename>, or if these files are missing.</para>
44
0ba56d36
LP
45 <para>This module preferably utilizes
46 <citerefentry><refentrytitle>systemd-userdbd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
47 for resolving users and groups, but also works without the service running.</para>
48
409093fe 49 <para>To activate the NSS module, add <literal>systemd</literal> to the lines starting with
f43a19ec
LP
50 <literal>passwd:</literal>, <literal>group:</literal>, <literal>shadow:</literal> and
51 <literal>gshadow:</literal> in <filename>/etc/nsswitch.conf</filename>.</para>
409093fe
LP
52
53 <para>It is recommended to place <literal>systemd</literal> after the <literal>files</literal> or
54 <literal>compat</literal> entry of the <filename>/etc/nsswitch.conf</filename> lines so that
f43a19ec
LP
55 <filename>/etc/passwd</filename>, <filename>/etc/group</filename>, <filename>/etc/shadow</filename> and
56 <filename>/etc/gshadow</filename> based mappings take precedence.</para>
409093fe
LP
57 </refsect1>
58
59 <refsect1>
4c2cf157 60 <title>Configuration in <filename>/etc/nsswitch.conf</filename></title>
409093fe
LP
61
62 <para>Here is an example <filename>/etc/nsswitch.conf</filename> file that enables
63 <command>nss-systemd</command> correctly:</para>
64
94f760ec 65 <!-- synchronize with other nss-* man pages and factory/etc/nsswitch.conf -->
38ccb557
LP
66 <programlisting>passwd: compat <command>systemd</command>
67group: compat [SUCCESS=merge] <command>systemd</command>
f43a19ec
LP
68shadow: compat <command>systemd</command>
69gshadow: files <command>systemd</command>
409093fe 70
d296c20f 71hosts: mymachines resolve [!UNAVAIL=return] files myhostname dns
409093fe
LP
72networks: files
73
74protocols: db files
75services: db files
76ethers: db files
77rpc: db files
78
79netgroup: nis</programlisting>
80
81 </refsect1>
82
4c2cf157
LP
83 <refsect1>
84 <title>Example: Mappings provided by <filename>systemd-machined.service</filename></title>
85
86 <para>The container <literal>rawhide</literal> is spawned using
87 <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>:
88 </para>
89
90 <programlisting># systemd-nspawn -M rawhide --boot --network-veth --private-users=pick
91Spawning container rawhide on /var/lib/machines/rawhide.
92Selected user namespace base 20119552 and range 65536.
93...
94
95$ machinectl --max-addresses=3
96MACHINE CLASS SERVICE OS VERSION ADDRESSES
97rawhide container systemd-nspawn fedora 30 169.254.40.164 fe80::94aa:3aff:fe7b:d4b9
98
99$ getent passwd vu-rawhide-0 vu-rawhide-81
100vu-rawhide-0:*:20119552:65534:vu-rawhide-0:/:/usr/sbin/nologin
101vu-rawhide-81:*:20119633:65534:vu-rawhide-81:/:/usr/sbin/nologin
102
103$ getent group vg-rawhide-0 vg-rawhide-81
104vg-rawhide-0:*:20119552:
105vg-rawhide-81:*:20119633:
106
107$ ps -o user:15,pid,tty,command -e|grep '^vu-rawhide'
108vu-rawhide-0 692 ? /usr/lib/systemd/systemd
109vu-rawhide-0 731 ? /usr/lib/systemd/systemd-journald
110vu-rawhide-192 734 ? /usr/lib/systemd/systemd-networkd
111vu-rawhide-193 738 ? /usr/lib/systemd/systemd-resolved
112vu-rawhide-0 742 ? /usr/lib/systemd/systemd-logind
113vu-rawhide-81 744 ? /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
114vu-rawhide-0 746 ? /usr/sbin/sshd -D ...
115vu-rawhide-0 752 ? /usr/lib/systemd/systemd --user
116vu-rawhide-0 753 ? (sd-pam)
117vu-rawhide-0 1628 ? login -- zbyszek
118vu-rawhide-1000 1630 ? /usr/lib/systemd/systemd --user
119vu-rawhide-1000 1631 ? (sd-pam)
120vu-rawhide-1000 1637 pts/8 -zsh
121</programlisting>
122 </refsect1>
123
409093fe
LP
124 <refsect1>
125 <title>See Also</title>
126 <para>
127 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
128 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
129 <citerefentry><refentrytitle>nss-resolve</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
130 <citerefentry><refentrytitle>nss-myhostname</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
131 <citerefentry><refentrytitle>nss-mymachines</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
4c2cf157
LP
132 <citerefentry><refentrytitle>systemd-userdbd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
133 <citerefentry><refentrytitle>systemd-homed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
134 <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
409093fe
LP
135 <citerefentry project='man-pages'><refentrytitle>nsswitch.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
136 <citerefentry project='man-pages'><refentrytitle>getent</refentrytitle><manvolnum>1</manvolnum></citerefentry>
137 </para>
138 </refsect1>
139
140</refentry>