Home Explore Blog CI



man-pages

4th chunk of `mount.man`
fd35fcce15513e9c35ab9c4fcc1ea81760dcc77d64367ac40000000100000fae
 /dev/cdrom /cd iso9660 ro,user,noauto,unhide

       any user can mount the iso9660 filesystem found on an inserted CDROM
       using the command:

          mount /cd

       Note that mount is very strict about non-root users and all paths
       specified on command line are verified before fstab is parsed or a
       helper program is executed. It’s strongly recommended to use a valid
       mountpoint to specify filesystem, otherwise mount may fail. For example
       it’s a bad idea to use NFS or CIFS source on command line.

       Since util-linux 2.35, mount does not exit when user permissions are
       inadequate according to libmount’s internal security rules. Instead, it
       drops suid permissions and continues as regular non-root user. This
       behavior supports use-cases where root permissions are not necessary
       (e.g., fuse filesystems, user namespaces, etc).

       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:

          mount --bind olddir newdir

       or by using this fstab entry:

          /olddir /newdir none bind

       After this call the same contents are accessible in two places.

       It is important to understand that "bind" does not create any
       second-class or special node in the kernel VFS. The "bind" is just
       another operation to attach a filesystem. There is nowhere stored
       information that the filesystem has been attached by a "bind" operation.
       The olddir and newdir are independent and the olddir may be unmounted.

       One can also remount a single file (on a single file). It’s also
       possible to use a bind mount to create a mountpoint from a regular
       directory, for example:

          mount --bind foo foo

       The bind mount call attaches only (part of) a single filesystem, not
       possible submounts. The entire file hierarchy including submounts can be
       attached a second place by using:

          mount --rbind olddir newdir

       Note that the filesystem mount options maintained by the kernel will
       remain the same as those on the original mount point. The userspace
       mount options (e.g., _netdev) will not be copied by mount and it’s
       necessary to explicitly specify the options on the mount command line.

       Since util-linux 2.27 mount permits changing the mount options by
       passing the relevant options along with --bind. For example:

          mount -o bind,ro foo foo

       This feature is not supported by the Linux kernel; it is implemented in
       userspace by an additional mount(2) remounting system call. This
       solution is not atomic.

       The alternative (classic) way to create a read-only bind mount is to use
       the remount operation, for example:

          mount --bind olddir newdir

          mount -o remount,bind,ro olddir newdir

       Note that a read-only bind will create a read-only mountpoint (VFS
       entry), but the original filesystem superblock will still be writable,
       meaning that the olddir will be writable, but the newdir will be
       read-only.

       It’s also possible

Title: User Mount Options and Bind Mount Operations
Summary
This section discusses user mount options, like 'user', 'users', 'owner', and 'group', which allow non-root users to mount filesystems specified in /etc/fstab. It details the 'user' option and its variants, and also explains bind mounts, which remount parts of the file hierarchy to another location. The difference between `--bind` and `--rbind` is clarified. Finally, it mentions how to change mount options, including creating read-only bind mounts, and explains how these options impact the kernel VFS and filesystem superblock.