man: User=, Group= *never* work for mount units (#7602)

Old text:

> Note that the User= and
> Group= options are not particularly useful for mount units specifying a
> "Type=" option or using configuration not specified in /etc/fstab;
> mount(8) will refuse options that are not listed in /etc/fstab if it is
> not run as UID 0.

However I recently learnt the following:

> The mount program does not read the /etc/fstab file if both device
> and dir are specified.

Therefore, if both device and dir are specified, the `user` or `users`
options in `fstab` will not have any effect.  Run as a normal user,
you will always see

    mount: only root can do that

Fix the explanation in the man page.

Also make sure to markup User= and Group= with <varname>.
This commit is contained in:
Alan Jenkins 2017-12-19 20:22:05 +00:00 committed by Lennart Poettering
parent 07fbf8807c
commit 5e0aff564c

View file

@ -76,13 +76,17 @@
which define the way the processes are terminated, and in
<citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
which configure resource control settings for the processes of the
service. Note that the User= and Group= options are not
particularly useful for mount units specifying a
<literal>Type=</literal> option or using configuration not
specified in <filename>/etc/fstab</filename>;
service.</para>
<para>Note that the options <varname>User=</varname> and
<varname>Group=</varname> are not useful for mount units.
systemd passes two parameters to
<citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>;
the values of <varname>What=</varname> and <varname>Where=</varname>.
When invoked in this way,
<citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
will refuse options that are not listed in
<filename>/etc/fstab</filename> if it is not run as UID 0.</para>
does not read any options from <filename>/etc/fstab</filename>, and
must be run as UID 0.</para>
<para>Mount units must be named after the mount point directories they control. Example: the mount point <filename
noindex='true'>/home/lennart</filename> must be configured in a unit file <filename>home-lennart.mount</filename>.