Home Explore Blog CI



man-pages

3rd chunk of `mount.man`
d2810690ed845bce6e5bdee55a9dce20aa4ef87649bf71500000000100000faa
 when
       mounting it, an arbitrary keyword - for example, proc - can be used
       instead of a device specification. (The customary choice none is less
       fortunate: the error message 'none already mounted' from mount can be
       confusing.)

   The files /etc/fstab, /etc/mtab and /proc/mounts
       The file /etc/fstab (see fstab(5)), may contain lines describing what
       devices are usually mounted where, using which options. The default
       location of the fstab(5) file can be overridden with the --fstab path
       command-line option (see below for more details).

       The command

          mount -a [-t type] [-O optlist]

       (usually given in a bootscript) causes all filesystems mentioned in
       fstab (of the proper type and/or having or not having the proper
       options) to be mounted as indicated, except for those whose line
       contains the noauto keyword. Adding the -F option will make mount fork,
       so that the filesystems are mounted in parallel.

       When mounting a filesystem mentioned in fstab or mtab, it suffices to
       specify on the command line only the device, or only the mount point.

       The programs mount and umount(8) traditionally maintained a list of
       currently mounted filesystems in the file /etc/mtab. The support for
       regular classic /etc/mtab is completely disabled at compile time by
       default, because on current Linux systems it is better to make /etc/mtab
       a symlink to /proc/mounts instead. The regular mtab file maintained in
       userspace cannot reliably work with namespaces, containers and other
       advanced Linux features. If the regular mtab support is enabled, then
       it’s possible to use the file as well as the symlink.

       If no arguments are given to mount, the list of mounted filesystems is
       printed.

       If you want to override mount options from /etc/fstab, you have to use
       the -o option:

          mount device|dir -o options

       and then the mount options from the command line will be appended to the
       list of options from /etc/fstab. This default behaviour can be changed
       using the --options-mode command-line option. The usual behavior is that
       the last option wins if there are conflicting ones.

       The mount program does not read the /etc/fstab file if both device (or
       LABEL, UUID, ID, PARTUUID or PARTLABEL) and dir are specified. For
       example, to mount device foo at /dir:

          mount /dev/foo /dir

       This default behaviour can be changed by using the
       --options-source-force command-line option to always read configuration
       from fstab. For non-root users mount always reads the fstab
       configuration.

   Non-superuser mounts
       Normally, only the superuser can mount filesystems. However, when fstab
       contains the user option on a line, anybody can mount the corresponding
       filesystem.

       Thus, given a line

          /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.

Title: Mounting Filesystems, /etc/fstab, and Non-Superuser Mounts
Summary
This section explains how filesystems are mounted using the `mount` command, referencing /etc/fstab for configuration. It details the use of `mount -a` to mount all filesystems listed in fstab, the handling of mount options, and the replacement of /etc/mtab with a symlink to /proc/mounts. It also covers non-superuser mounts, where regular users can mount filesystems specified in fstab with the 'user' option. The section also explains util-linux's behaviour when permissions are not adequate, dropping suid permissions rather than exiting.