<?xml version="1.0" encoding="UTF-8"?>
<!-- **************************************************************************
.... For copyright and licensing terms, see the file named COPYING.
.... **************************************************************************
.-->
<?xml-stylesheet href="docbook-xml.css" type="text/css"?>

<refentry id="make-private-fs">

<refmeta xmlns:xi="http://www.w3.org/2001/XInclude">
<refentrytitle>make-private-fs</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">user commands</refmiscinfo>
<refmiscinfo class="source">nosh</refmiscinfo>
<xi:include href="version.xml" />
</refmeta>

<refnamediv>
<refname>make-private-fs</refname>
<refpurpose>populate various private-mount parts of the filesystem</refpurpose>
</refnamediv>

<refsynopsisdiv>
<cmdsynopsis>
<command>make-private-fs</command>
<arg choice='opt'>--temp</arg>
<arg choice='opt'>--devices</arg>
<arg choice='opt'>--homes</arg>
<arg choice='opt'>--hide <replaceable>directory</replaceable></arg>
<arg choice='req'><replaceable>next-prog</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>

<refsection><title>Description</title>

<para>
<command>make-private-fs</command> is a chain-loading utility that mounts private volumes in various parts of the filesystem namespace and pre-populates them, and then chain loads to <replaceable>next-prog</replaceable> with the <citerefentry><refentrytitle>execvp</refentrytitle><manvolnum>3</manvolnum></citerefentry> function.
</para>

<para>
<replaceable>next-prog</replaceable> may contain its own command line options, which <command>make-private-fs</command> will ignore.
</para>

<para>
The parts of the filesystem that are mounted and populated are controlled by command-line options as follows:
</para>

<variablelist>

<varlistentry>
<term><arg choice='plain'>--temp</arg></term>
<listitem>
<para>
Empty directories, held below a superuser-only-accessible parent, are mounted at <filename>/tmp</filename> and <filename>/var/tmp</filename>.
They have <code>rwx</code> permissions for the owner, group, and world; and they have the sticky bit set.
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><arg choice='plain'>--devices</arg></term>
<listitem>
<para>
A <code>tmpfs</code> filesystem is mounted at <filename>/dev</filename>, without any real devices in it.
It is populated only with "API" devices such as <filename>/dev/shm</filename>.
On Linux, a <code>devpts</code> filesystem is mounted at <filename>/dev/pts</filename>.
On BSD systems, a <code>fdescfs</code> filesystem is mounted at <filename>/dev/fd</filename>.
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><arg choice='plain'>--homes</arg></term>
<listitem>
<para>
This is causes empty directories, held below a superuser-only-accessible parent, to be mounted at various user home directories, or collections of user home directories.
It is currently equivalent to <arg choice='plain'>--hide</arg> <filename>/home</filename>, <arg choice='plain'>--hide</arg> <filename>/run/user</filename>, and <arg choice='plain'>--hide</arg> <filename>/root</filename>.
</para>
<note>
Pseudo-user home directories such as <filename>/var/lib/rabbitmq</filename>, <filename>/var/lib/qmail</filename>, and <filename>/var/lib/mysql</filename> are not covered by this, as they are not considered to hold an individual real user's private files.
</note>
</listitem>
</varlistentry>

<varlistentry>
<term><arg choice='plain'>--hide</arg> <replaceable>directory</replaceable></term>
<listitem>
<para>
Empty directories, held below a superuser-only-accessible parent, are mounted at <filename><replaceable>directory</replaceable></filename>.
They have <code>rwx</code> permissions for the owner, and no permissions for anyone else.
</para>
</listitem>
</varlistentry>

</variablelist>

<para>
The command will fail if the process is not running under the aegis of the superuser, because most of the internal operations necessary are not permitted to non-superusers.
</para>

</refsection><refsection><title>Usage</title>

<para>
<command>make-private-fs</command> is usually run chain-loaded from <citerefentry><refentrytitle>unshare</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
Beware: Running it without unsharing first will affect the global mount namespace.
</para>

</refsection><refsection><title>Author</title>
<para><author><personname><firstname>Jonathan</firstname> <surname>de Boyne Pollard</surname></personname></author></para>
</refsection>

</refentry>
