if (rc)
return rc;
+ /*
+ * Ignore user=<name> (if <name> is set). Let's keep it hidden
+ * for normal library operations, but visible for /sbin/mount.<type>
+ * helpers.
+ */
+ if (user_flags & MNT_MS_USER
+ && (opt = mnt_optlist_get_opt(ol, MNT_MS_USER, cxt->map_userspace))
+ && mnt_opt_has_value(opt)) {
+ DBG(CXT, ul_debugobj(cxt, "perms: user=<name> detected, ignore"));
+
+ cxt->flags |= MNT_FL_SAVED_USER;
+
+ mnt_opt_set_external(opt, 1);
+ user_flags &= ~MNT_MS_USER;
+ }
+
if (!mnt_context_is_restricted(cxt)) {
/*
* superuser mount
return -EPERM;
}
- /*
- * Ignore user=<name> (if <name> is set). Let's keep it hidden
- * for normal library operations, but visible for /sbin/mount.<type>
- * helpers.
- */
- if (user_flags & MNT_MS_USER
- && (opt = mnt_optlist_get_opt(ol, MNT_MS_USER, cxt->map_userspace))
- && mnt_opt_has_value(opt)) {
- DBG(CXT, ul_debugobj(cxt, "perms: user=<name> detected, ignore"));
-
- cxt->flags |= MNT_FL_SAVED_USER;
-
- mnt_opt_set_external(opt, 1);
- user_flags &= ~MNT_MS_USER;
- }
-
/*
* Insert MS_SECURE between system flags on position where is MNT_MS_USER
*/
For more details, see *fstab*(5). Only the user that mounted a filesystem can unmount it again. If any user should be able to unmount it, then use *users* instead of *user* in the _fstab_ line. The *owner* option is similar to the *user* option, with the restriction that the user must be the owner of the special file. This may be useful e.g. for _/dev/fd_ if a login script makes the console user owner of this device. The *group* option is similar, with the restriction that the user must be a member of the group of the special file.
+The *user* mount option is accepted if no username is specified. If used in the format *user=someone*, the option is silently ignored and visible only for external mount helpers (/sbin/mount.<type>) for compatibility with some network filesystems.
+
=== Bind mount operation
Remount part of the file hierarchy somewhere else. The call is: