1.\" Copyright (c) 1980, 1989, 1991, 1993 2.\" The Regents of the University of California. 3.\" Copyright (c) 2005, 2006 Csaba Henk 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" $FreeBSD$ 31.\" 32.Dd May 19, 2019 33.Dt MOUNT_FUSEFS 8 34.Os 35.Sh NAME 36.Nm mount_fusefs 37.Nd mount a Fuse file system daemon 38.Sh SYNOPSIS 39.Nm 40.Op Fl A 41.Op Fl S 42.Op Fl v 43.Op Fl D Ar fuse_daemon 44.Op Fl O Ar daemon_opts 45.Op Fl s Ar special 46.Op Fl m Ar node 47.Op Fl h 48.Op Fl V 49.Op Fl o Ar option ... 50.Ar special node 51.Op Ar fuse_daemon ... 52.Sh DESCRIPTION 53Basic usage is to start a fuse daemon on the given 54.Ar special 55file. 56In practice, the daemon is assigned a 57.Ar special 58file automatically, which can then be indentified via 59.Xr fstat 1 . 60That special file can then be mounted by 61.Nm . 62.Pp 63However, the procedure of spawning a daemon will usually be automated 64so that it is performed by 65.Nm . 66If the command invoking a given 67.Ar fuse_daemon 68is appended to the list of arguments, 69.Nm 70will call the 71.Ar fuse_daemon 72via that command. 73In that way the 74.Ar fuse_daemon 75will be instructed to attach itself to 76.Ar special . 77From that on mounting goes as in the simple case. (See 78.Sx DAEMON MOUNTS . ) 79.Pp 80The 81.Ar special 82argument will normally be treated as the path of the special file to mount. 83.Pp 84However, if 85.Pa auto 86is passed as 87.Ar special , 88then 89.Nm 90will look for a suitable free fuse device by itself. 91.Pp 92Finally, if 93.Ar special 94is an integer it will be interpreted as the number 95of the file descriptor of an already open fuse device 96(used when the Fuse library invokes 97.Nm . 98(See 99.Sx DAEMON MOUNTS ) . 100.Pp 101The options are as follows: 102.Bl -tag -width indent 103.It Fl A , Ic --reject-allow_other 104Prohibit the 105.Cm allow_other 106mount flag. 107Intended for use in scripts and the 108.Xr sudoers 5 109file. 110.It Fl S , Ic --safe 111Run in safe mode (i.e. reject invoking a filesystem daemon) 112.It Fl v 113Be verbose 114.It Fl D, Ic --daemon Ar daemon 115Call the specified 116.Ar daemon 117.It Fl O, Ic --daemon_opts Ar opts 118Add 119.Ar opts 120to the daemon's command line 121.It Fl s, Ic --special Ar special 122Use 123.Ar special 124as special 125.It Fl m, Ic --mountpath Ar node 126Mount on 127.Ar node 128.It Fl h, Ic --help 129Show help 130.It Fl V, Ic --version 131Show version information 132.It Fl o 133Mount options are specified via 134.Fl o . 135The following options are available (and also their negated versions, 136by prefixing them with 137.Dq no ) : 138.Bl -tag -width indent 139.It Cm default_permissions 140Enable traditional (file mode based) permission checking in kernel 141.It Cm allow_other 142Do not apply 143.Sx STRICT ACCESS POLICY . 144Only root can use this option 145.It Cm max_read Ns = Ns Ar n 146Limit size of read requests to 147.Ar n 148.It Cm private 149Refuse shared mounting of the daemon. 150This is the default behaviour, to allow sharing, expicitly use 151.Fl o Cm noprivate 152.It Cm neglect_shares 153Do not refuse unmounting if there are secondary mounts 154.It Cm push_symlinks_in 155Prefix absolute symlinks with the mountpoint 156.It Cm subtype Ns = Ns Ar fsname 157Suffix 158.Ar fsname 159to the file system name as reported by 160.Xr statfs 2 . 161This option can be used to identify the file system implemented by 162.Ar fuse_daemon . 163.El 164.El 165.Pp 166Besides the above mount options, there is a set of pseudo-mount options which 167are supported by the Fuse library. 168One can list these by passing 169.Fl h 170to a Fuse daemon. 171Most of these options only have affect on the behavior of the daemon (that is, 172their scope is limited to userspace). 173However, there are some which do require in-kernel support. 174Currently the options supported by the kernel are: 175.Bl -tag -width indent 176.It Cm direct_io 177Bypass the buffer cache system 178.It Cm kernel_cache 179By default cached buffers of a given file are flushed at each 180.Xr open 2 . 181This option disables this behaviour 182.El 183.Sh DAEMON MOUNTS 184Usually users do not need to use 185.Nm 186directly, as the Fuse library enables Fuse daemons to invoke 187.Nm . 188That is, 189.Pp 190.Dl fuse_daemon device mountpoint 191.Pp 192has the same effect as 193.Pp 194.Dl mount_fusefs auto mountpoint fuse_daemon 195.Pp 196This is the recommended usage when you want basic usage 197(eg, run the daemon at a low privilege level but mount it as root). 198.Sh STRICT ACCESS POLICY 199The strict access policy for Fuse filesystems lets one to use the filesystem 200only if the filesystem daemon has the same credentials (uid, real uid, gid, 201real gid) as the user. 202.Pp 203This is applied for Fuse mounts by default and only root can mount without 204the strict access policy (i.e. the 205.Cm allow_other 206mount option). 207.Pp 208This is to shield users from the daemon 209.Dq spying 210on their I/O activities. 211.Pp 212Users might opt to willingly relax strict access policy (as far they 213are concerned) by doing their own secondary mount (See 214.Sx SHARED MOUNTS ) . 215.Sh SHARED MOUNTS 216A Fuse daemon can be shared (i.e. mounted multiple times). 217When doing the first (primary) mount, the spawner and the mounter of the daemon 218must have the same uid, or the mounter should be the superuser. 219.Pp 220After the primary mount is in place, secondary mounts can be done by anyone 221unless this feature is disabled by 222.Cm private . 223The behaviour of a secondary mount is analogous to that of symbolic 224links: they redirect all filesystem operations to the primary mount. 225.Pp 226Doing a secondary mount is like signing an agreement: by this action, the mounter 227agrees that the Fuse daemon can trace her I/O activities. 228From then on she is not banned from using the filesystem 229(either via her own mount or via the primary mount), regardless whether 230.Cm allow_other 231is used or not. 232.Pp 233The device name of a secondary mount is the device name of the corresponding 234primary mount, followed by a '#' character and the index of the secondary 235mount; e.g. 236.Pa /dev/fuse0#3 . 237.Sh SECURITY 238System administrators might want to use a custom mount policy (ie., one going 239beyond the 240.Va vfs.usermount 241sysctl). 242The primary tool for such purposes is 243.Xr sudo 8 . 244However, given that 245.Nm 246is capable of invoking an arbitrary program, one must be careful when doing this. 247.Nm 248is designed in a way such that it makes that easy. 249For this purpose, there are options which disable certain risky features (i.e. 250.Fl S 251and 252.Fl A ) , 253and command line parsing is done in a flexible way: mixing options and 254non-options is allowed, but processing them stops at the third non-option 255argument (after the first two has been utilized as device and mountpoint). 256The rest of the command line specifies the daemon and its arguments. 257(Alternatively, the daemon, the special and the mount path can be 258specified using the respective options.) Note that 259.Nm 260ignores the environment variable 261.Ev POSIXLY_CORRECT 262and always behaves as described. 263.Pp 264In general, to be as scripting / 265.Xr sudoers 5 266friendly as possible, no information has a fixed 267position in the command line, but once a given piece of information is 268provided, subsequent arguments/options cannot override it (with the 269exception of some non-critical ones). 270.Sh ENVIRONMENT 271.Bl -tag -width ".Ev MOUNT_FUSEFS_SAFE" 272.It Ev MOUNT_FUSEFS_SAFE 273This has the same effect as the 274.Fl S 275option. 276.It Ev MOUNT_FUSEFS_VERBOSE 277This has the same effect as the 278.Fl v 279option. 280.It Ev MOUNT_FUSEFS_IGNORE_UNKNOWN 281If set, 282.Nm 283will ignore uknown mount options. 284.It Ev MOUNT_FUSEFS_CALL_BY_LIB 285Adjust behavior to the needs of the FUSE library. 286Currently it effects help output. 287.El 288.Pp 289Although the following variables do not have any effect on 290.Nm 291itself, they affect the behaviour of fuse daemons: 292.Bl -tag -width ".Ev FUSE_DEV_NAME" 293.It Ev FUSE_DEV_NAME 294Device to attach. 295If not set, the multiplexer path 296.Ar /dev/fuse 297is used. 298.It Ev FUSE_DEV_FD 299File desciptor of an opened Fuse device to use. 300Overrides 301.Ev FUSE_DEV_NAME . 302.It Ev FUSE_NO_MOUNT 303If set, the library will not attempt to mount the filesystem, even 304if a mountpoint argument is supplied. 305.El 306.Sh FILES 307.Bl -tag -width /dev/fuse 308.It Pa /dev/fuse 309Fuse device with which the kernel and Fuse daemons can communicate. 310.It Pa /dev/fuse 311The multiplexer path. 312An 313.Xr open 2 314performed on it automatically is passed to a free Fuse device by the kernel 315(which might be created just for this puprose). 316.El 317.Sh EXAMPLES 318Mount the example filesystem in the Fuse distribution (from its directory): 319either 320.Pp 321.Dl ./fusexmp /mnt/fuse 322.Pp 323or 324.Pp 325.Dl mount_fusefs auto /mnt/fuse ./fusexmp 326.Pp 327Doing the same in two steps, using 328.Pa /dev/fuse0 : 329.Pp 330.Dl FUSE_DEV_NAME=/dev/fuse ./fusexmp && 331.Dl mount_fusefs /dev/fuse /mnt/fuse 332.Pp 333A script wrapper for fusexmp which ensures that 334.Nm 335does not call any external utility and also provides a hacky 336(non race-free) automatic device selection: 337.Pp 338.Dl #!/bin/sh -e 339.Pp 340.Dl FUSE_DEV_NAME=/dev/fuse fusexmp 341.Dl mount_fusefs -S /dev/fuse /mnt/fuse \(lq$@\(rq 342.Sh SEE ALSO 343.Xr fstat 1 , 344.Xr mount 8 , 345.Xr sudo 8 , 346.Xr umount 8 347.Sh HISTORY 348.Nm 349was written as the part of the 350.Fx 351implementation of the Fuse userspace filesystem framework (see 352.Xr https://github.com/libfuse/libfuse ) 353and first appeared in the 354.Pa sysutils/fusefs-kmod 355port, supporting 356.Fx 6.0 . 357It was added to the base system in 358.Fx 10.0 . 359.Sh CAVEATS 360This user interface is 361.Fx 362specific. 363Secondary mounts should be unmounted via their device name. 364If an attempt is made to unmount them via their filesystem root path, 365the unmount request will be forwarded to the primary mount path. 366In general, unmounting by device name is less error-prone than by mount path 367(although the latter will also work under normal circumstances). 368.Pp 369If the daemon is specified via the 370.Fl D 371and 372.Fl O 373options, it will be invoked via 374.Xr system 3 , 375and the daemon's command line will also have an 376.Dq & 377control operator appended, so that we do not have to wait for its termination. 378You should use a simple command line when invoking the daemon via these options. 379.Sh BUGS 380.Ar special 381is treated as a multiplexer if and only if it is literally the same as 382.Pa auto 383or 384.Pa /dev/fuse . 385Other paths which are equivalent with 386.Pa /dev/fuse 387(eg., 388.Pa /../dev/fuse ) 389are not. 390