]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/nss-mymachines.xml
meson: allow building resolved and machined without nss modules
[thirdparty/systemd.git] / man / nss-mymachines.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6 SPDX-License-Identifier: LGPL-2.1+
7 -->
8
9 <refentry id="nss-mymachines" conditional='ENABLE_NSS_MYMACHINES'>
10
11 <refentryinfo>
12 <title>nss-mymachines</title>
13 <productname>systemd</productname>
14 </refentryinfo>
15
16 <refmeta>
17 <refentrytitle>nss-mymachines</refentrytitle>
18 <manvolnum>8</manvolnum>
19 </refmeta>
20
21 <refnamediv>
22 <refname>nss-mymachines</refname>
23 <refname>libnss_mymachines.so.2</refname>
24 <refpurpose>Provide hostname resolution for local
25 container instances.</refpurpose>
26 </refnamediv>
27
28 <refsynopsisdiv>
29 <para><filename>libnss_mymachines.so.2</filename></para>
30 </refsynopsisdiv>
31
32 <refsect1>
33 <title>Description</title>
34
35 <para><command>nss-mymachines</command> is a plug-in module for the GNU Name Service Switch (NSS) functionality of
36 the GNU C Library (<command>glibc</command>), providing hostname resolution for the names of containers running
37 locally that are registered with
38 <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>. The
39 container names are resolved to the IP addresses of the specific container, ordered by their scope. This
40 functionality only applies to containers using network namespacing.</para>
41
42 <para>The module also resolves user and group IDs used by containers to user and group names indicating the
43 container name, and back. This functionality only applies to containers using user namespacing.</para>
44
45 <para>To activate the NSS module, add <literal>mymachines</literal> to the lines starting with
46 <literal>hosts:</literal>, <literal>passwd:</literal> and <literal>group:</literal> in
47 <filename>/etc/nsswitch.conf</filename>.</para>
48
49 <para>It is recommended to place <literal>mymachines</literal> after the <literal>files</literal> or
50 <literal>compat</literal> entry of the <filename>/etc/nsswitch.conf</filename> lines to make sure that its mappings
51 are preferred over other resolvers such as DNS, but so that <filename>/etc/hosts</filename>,
52 <filename>/etc/passwd</filename> and <filename>/etc/group</filename> based mappings take precedence.</para>
53 </refsect1>
54
55 <refsect1>
56 <title>Example</title>
57
58 <para>Here is an example <filename>/etc/nsswitch.conf</filename> file that enables
59 <command>nss-mymachines</command> correctly:</para>
60
61 <programlisting>passwd: compat <command>mymachines</command> systemd
62 group: compat <command>mymachines</command> systemd
63 shadow: compat
64
65 hosts: files <command>mymachines</command> resolve [!UNAVAIL=return] dns myhostname
66 networks: files
67
68 protocols: db files
69 services: db files
70 ethers: db files
71 rpc: db files
72
73 netgroup: nis</programlisting>
74
75 </refsect1>
76
77 <refsect1>
78 <title>See Also</title>
79 <para>
80 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
81 <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
82 <citerefentry><refentrytitle>nss-systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
83 <citerefentry><refentrytitle>nss-resolve</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
84 <citerefentry><refentrytitle>nss-myhostname</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
85 <citerefentry project='man-pages'><refentrytitle>nsswitch.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
86 <citerefentry project='man-pages'><refentrytitle>getent</refentrytitle><manvolnum>1</manvolnum></citerefentry>
87 </para>
88 </refsect1>
89
90 </refentry>