nspawn: Add --bind-user-shell= to control shells for --bind-user

Prior to this change, no user shell can be specified in the user
records passed into a container via --bind-user=. This new option
allows users to:

1. When false (the default), continue to specify no user shell for
   each bound user record, resulting in the use of the container's
   default shell for bound users.

2. When true, include each host user's shell in the corresponding
   user record passed into a container (via --bind-user=).

3. When an absolute path, set that path as the user shell for each
   user record passed into a container (via --bind-user=).

This does not change the existing behavior, but allows users to
opt-in to either copy the shells specified by the host user records
or override the shell explicitly by path.
This commit is contained in:
Nick Labich
2025-06-30 10:45:10 +02:00
committed by Lennart Poettering
parent 381304a209
commit a9e860f22e
9 changed files with 300 additions and 6 deletions
+12
View File
@@ -495,6 +495,18 @@
<xi:include href="version-info.xml" xpointer="v249"/></listitem>
</varlistentry>
<varlistentry>
<term><varname>BindUserShell=</varname></term>
<listitem><para>When used with <varname>BindUser</varname>, specifies the shell that is included in
the user record of users bound from the host into the container. This option is equivalent to the
command line switch <option>--bind-user-shell=</option>, see
<citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>
for details about the specific options supported. This setting is privileged (see above).</para>
<xi:include href="version-info.xml" xpointer="v258"/></listitem>
</varlistentry>
<varlistentry>
<term><varname>TemporaryFileSystem=</varname></term>