]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - sbin/mount_fusefs/mount_fusefs.8
MFC r357223:
[FreeBSD/stable/10.git] / sbin / mount_fusefs / mount_fusefs.8
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 .\" 4. 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 October 3, 2016
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
53 Basic usage is to start a fuse daemon on the given
54 .Ar special
55 file.
56 In practice, the daemon is assigned a
57 .Ar special
58 file automatically, which can then be indentified via
59 .Xr fstat 1 .
60 That special file can then be mounted by
61 .Nm .
62 .Pp
63 However, the procedure of spawning a daemon will usually be automated
64 so that it is performed by
65 .Nm .
66 If the command invoking a given
67 .Ar fuse_daemon
68 is appended to the list of arguments,
69 .Nm
70 will call the
71 .Ar fuse_daemon
72 via that command.
73 In that way the
74 .Ar fuse_daemon
75 will be instructed to attach itself to
76 .Ar special .
77 From that on mounting goes as in the simple case. (See
78 .Sx DAEMON MOUNTS . )
79 .Pp
80 The
81 .Ar special
82 argument will normally be treated as the path of the special file to mount.
83 .Pp
84 However, if
85 .Pa auto
86 is passed as
87 .Ar special ,
88 then
89 .Nm
90 will look for a suitable free fuse device by itself.
91 .Pp
92 Finally, if
93 .Ar special
94 is an integer it will be interpreted as the number
95 of 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
101 The options are as follows:
102 .Bl -tag -width indent
103 .It Fl A , Ic --reject-allow_other
104 Prohibit the
105 .Cm allow_other
106 mount flag.
107 Intended for use in scripts and the
108 .Xr sudoers 5
109 file.
110 .It Fl S , Ic --safe
111 Run in safe mode (i.e. reject invoking a filesystem daemon)
112 .It Fl v
113 Be verbose
114 .It Fl D, Ic --daemon Ar daemon
115 Call the specified
116 .Ar daemon
117 .It Fl O, Ic --daemon_opts Ar opts
118 Add
119 .Ar opts
120 to the daemon's command line
121 .It Fl s, Ic --special Ar special
122 Use
123 .Ar special
124 as special
125 .It Fl m, Ic --mountpath Ar node
126 Mount on
127 .Ar node
128 .It Fl h, Ic --help
129 Show help
130 .It Fl V, Ic --version
131 Show version information
132 .It Fl o
133 Mount options are specified via
134 .Fl o .
135 The following options are available (and also their negated versions,
136 by prefixing them with
137 .Dq no ) :
138 .Bl -tag -width indent
139 .It Cm default_permissions
140 Enable traditional (file mode based) permission checking in kernel
141 .It Cm allow_other
142 Do not apply
143 .Sx STRICT ACCESS POLICY .
144 Only root can use this option
145 .It Cm max_read Ns = Ns Ar n
146 Limit size of read requests to
147 .Ar n
148 .It Cm private
149 Refuse shared mounting of the daemon.
150 This is the default behaviour, to allow sharing, expicitly use
151 .Fl o Cm noprivate
152 .It Cm neglect_shares
153 Do not refuse unmounting if there are secondary mounts
154 .It Cm push_symlinks_in
155 Prefix absolute symlinks with the mountpoint
156 .El
157 .Pp
158 .El
159 .Pp
160 Besides the above mount options, there is a set of pseudo-mount options which
161 are supported by the Fuse library.
162 One can list these by passing
163 .Fl h
164 to a Fuse daemon.
165 Most of these options only have affect on the behavior of the daemon (that is,
166 their scope is limited to userspace).
167 However, there are some which do require in-kernel support.
168 Currently the options supported by the kernel are:
169 .Bl -tag -width indent
170 .It Cm direct_io
171 Bypass the buffer cache system
172 .It Cm kernel_cache
173 By default cached buffers of a given file are flushed at each
174 .Xr open 2 .
175 This option disables this behaviour
176 .El
177 .Sh DAEMON MOUNTS
178 Usually users do not need to use
179 .Nm
180 directly, as the Fuse library enables Fuse daemons to invoke
181 .Nm .
182 That is,
183 .Pp
184 .Dl fuse_daemon device mountpoint
185 .Pp
186 has the same effect as
187 .Pp
188 .Dl mount_fusefs auto mountpoint fuse_daemon
189 .Pp
190 This is the recommended usage when you want basic usage
191 (eg, run the daemon at a low privilege level but mount it as root).
192 .Sh STRICT ACCESS POLICY
193 The strict access policy for Fuse filesystems lets one to use the filesystem
194 only if the filesystem daemon has the same credentials (uid, real uid, gid,
195 real gid) as the user.
196 .Pp
197 This is applied for Fuse mounts by default and only root can mount without
198 the strict access policy (i.e. the
199 .Cm allow_other
200 mount option).
201 .Pp
202 This is to shield users from the daemon
203 .Dq spying
204 on their I/O activities.
205 .Pp
206 Users might opt to willingly relax strict access policy (as far they
207 are concerned) by doing their own secondary mount (See
208 .Sx SHARED MOUNTS ) .
209 .Sh SHARED MOUNTS
210 A Fuse daemon can be shared (i.e. mounted multiple times).
211 When doing the first (primary) mount, the spawner and the mounter of the daemon
212 must have the same uid, or the mounter should be the superuser.
213 .Pp
214 After the primary mount is in place, secondary mounts can be done by anyone
215 unless this feature is disabled by
216 .Cm private .
217 The behaviour of a secondary mount is analogous to that of symbolic
218 links: they redirect all filesystem operations to the primary mount.
219 .Pp
220 Doing a secondary mount is like signing an agreement: by this action, the mounter
221 agrees that the Fuse daemon can trace her I/O activities.
222 From then on she is not banned from using the filesystem
223 (either via her own mount or via the primary mount), regardless whether
224 .Cm allow_other
225 is used or not.
226 .Pp
227 The device name of a secondary mount is the device name of the corresponding
228 primary mount, followed by a '#' character and the index of the secondary
229 mount; e.g.
230 .Pa /dev/fuse0#3 .
231 .Sh SECURITY
232 System administrators might want to use a custom mount policy (ie., one going
233 beyond the
234 .Va vfs.usermount
235 sysctl).
236 The primary tool for such purposes is
237 .Xr sudo 8 .
238 However, given that
239 .Nm
240 is capable of invoking an arbitrary program, one must be careful when doing this.
241 .Nm
242 is designed in a way such that it makes that easy.
243 For this purpose, there are options which disable certain risky features (i.e.
244 .Fl S
245 and
246 .Fl A ) ,
247 and command line parsing is done in a flexible way: mixing options and
248 non-options is allowed, but processing them stops at the third non-option
249 argument (after the first two has been utilized as device and mountpoint).
250 The rest of the command line specifies the daemon and its arguments.
251 (Alternatively, the daemon, the special and the mount path can be
252 specified using the respective options.) Note that
253 .Nm
254 ignores the environment variable
255 .Ev POSIXLY_CORRECT
256 and always behaves as described.
257 .Pp
258 In general, to be as scripting /
259 .Xr sudoers 5
260 friendly as possible, no information has a fixed
261 position in the command line, but once a given piece of information is
262 provided, subsequent arguments/options cannot override it (with the
263 exception of some non-critical ones).
264 .Sh ENVIRONMENT
265 .Bl -tag -width ".Ev MOUNT_FUSEFS_SAFE"
266 .It Ev MOUNT_FUSEFS_SAFE
267 This has the same effect as the
268 .Fl S
269 option.
270 .It Ev MOUNT_FUSEFS_VERBOSE
271 This has the same effect as the
272 .Fl v
273 option.
274 .It Ev MOUNT_FUSEFS_IGNORE_UNKNOWN
275 If set,
276 .Nm
277 will ignore uknown mount options.
278 .It Ev MOUNT_FUSEFS_CALL_BY_LIB
279 Adjust behavior to the needs of the FUSE library.
280 Currently it effects help output.
281 .El
282 .Pp
283 Although the following variables do not have any effect on
284 .Nm
285 itself, they affect the behaviour of fuse daemons:
286 .Bl -tag -width ".Ev FUSE_DEV_NAME"
287 .It Ev FUSE_DEV_NAME
288 Device to attach.
289 If not set, the multiplexer path
290 .Ar /dev/fuse
291 is used.
292 .It Ev FUSE_DEV_FD
293 File desciptor of an opened Fuse device to use.
294 Overrides
295 .Ev FUSE_DEV_NAME .
296 .It Ev FUSE_NO_MOUNT
297 If set, the library will not attempt to mount the filesystem, even
298 if a mountpoint argument is supplied.
299 .El
300 .Sh FILES
301 .Bl -tag -width /dev/fuse
302 .It Pa /dev/fuse
303 Fuse device with which the kernel and Fuse daemons can communicate.
304 .It Pa /dev/fuse
305 The multiplexer path.
306 An
307 .Xr open 2
308 performed on it automatically is passed to a free Fuse device by the kernel
309 (which might be created just for this puprose).
310 .El
311 .Sh EXAMPLES
312 Mount the example filesystem in the Fuse distribution (from its directory):
313 either
314 .Pp
315 .Dl ./fusexmp /mnt/fuse
316 .Pp
317 or
318 .Pp
319 .Dl mount_fusefs auto /mnt/fuse ./fusexmp
320 .Pp
321 Doing the same in two steps, using
322 .Pa /dev/fuse0 :
323 .Pp
324 .Dl FUSE_DEV_NAME=/dev/fuse ./fusexmp &&
325 .Dl mount_fusefs /dev/fuse /mnt/fuse
326 .Pp
327 A script wrapper for fusexmp which ensures that
328 .Nm
329 does not call any external utility and also provides a hacky
330 (non race-free) automatic device selection:
331 .Pp
332 .Dl #!/bin/sh -e
333 .Pp
334 .Dl FUSE_DEV_NAME=/dev/fuse fusexmp
335 .Dl mount_fusefs -S /dev/fuse /mnt/fuse \(lq$@\(rq
336 .Sh SEE ALSO
337 .Xr fstat 1 ,
338 .Xr mount 8 ,
339 .Xr umount 8 ,
340 .Xr sudo 8
341 .Sh HISTORY
342 .Nm
343 appeared in
344 .Fx 10.0
345 as the part of the
346 .Fx
347 implementation of the Fuse userspace filesystem
348 framework (see http://fuse.sourceforge.net).
349 .Sh CAVEATS
350 This user interface is
351 .Fx
352 specific.
353 Secondary mounts should be unmounted via their device name.
354 If an attempt is made to unmount them via their filesystem root path,
355 the unmount request will be forwarded to the primary mount path.
356 In general, unmounting by device name is less error-prone than by mount path
357 (although the latter will also work under normal circumstances).
358 .Pp
359 If the daemon is specified via the
360 .Fl D
361 and
362 .Fl O
363 options, it will be invoked via
364 .Xr system 3 ,
365 and the daemon's command line will also have an
366 .Dq &
367 control operator appended, so that we do not have to wait for its termination.
368 You should use a simple command line when invoking the daemon via these options.
369 .Sh BUGS
370 .Ar special
371 is treated as a multiplexer if and only if it is literally the same as
372 .Pa auto
373 or
374 .Pa /dev/fuse .
375 Other paths which are equivalent with
376 .Pa /dev/fuse
377 (eg.,
378 .Pa /../dev/fuse )
379 are not.