blob: 052effc94afca166ff1bd952daf67d6a44774546 [file] [log] [blame] [view]
Nikolaus Rathdfbfd132015-12-20 13:52:30 -08001libfuse
2=======
3
4About
5-----
6
7FUSE (Filesystem in Userspace) is an interface for userspace programs
8to export a filesystem to the Linux kernel. The FUSE project consists
9of two components: the *fuse* kernel module (maintained in the regular
10kernel repositories) and the *libfuse* userspace library (maintained
11in this repository). libfuse provides the reference implementation
12for communicating with the FUSE kernel module.
13
14A FUSE file system is typically implemented as a standalone
15application that links with libfuse. libfuse provides functions to
16mount the file system, unmount it, read requests from the kernel, and
17send responses back. libfuse offers two APIs: a "high-level",
18synchronous API, and a "low-level" asynchronous API. In both cases,
19incoming requests from the kernel are passed to the main program using
20callbacks. When using the high-level API, the callbacks may work with
21file names and paths instead of inodes, and processing of a request
22finishes when the callback function returns. When using the low-level
23API, the callbacks must work with inodes and responses must be sent
24explicitly using a separate set of API functions.
25
26
Nikolaus Rathd45fec12019-04-29 11:55:56 -070027Development Status
28------------------
29
30libfuse is shipped by all major Linux distributions and has been in
31production use across a wide range of systems for many years. However,
32at present libfuse does not have any active, regular contributors. The
33current maintainer continues to apply pull requests and makes regular
34releases, but unfortunately has no capacity to do any development
35beyond addressing high-impact issues. When reporting bugs, please
36understand that unless you are including a pull request or are
37reporting a critical issue, you will probably not get a response. If
John Baber-Luceroe6df67c2021-01-12 05:41:35 -050038you are using libfuse, please consider contributing to the project.
Nikolaus Rathd45fec12019-04-29 11:55:56 -070039
40
Nikolaus Rath8d6b7582017-06-06 09:31:50 -040041Supported Platforms
42-------------------
43
44* Linux (fully)
45* BSD (mostly/best-effort)
46* For OS-X, please use [OSXFUSE](https://osxfuse.github.io/)
47
48
Nikolaus Rathdfbfd132015-12-20 13:52:30 -080049Installation
50------------
51
Nikolaus Rath579c3b02015-12-21 19:17:47 -080052You can download libfuse from
John Baber-Luceroe6df67c2021-01-12 05:41:35 -050053https://github.com/libfuse/libfuse/releases. To build and install, you
54must use [Meson](http://mesonbuild.com/) and
Nikolaus Rathe469e1f2018-10-16 06:06:19 -070055[Ninja](https://ninja-build.org). After extracting the libfuse
56tarball, create a (temporary) build directory and run Meson:
Nikolaus Rath579c3b02015-12-21 19:17:47 -080057
Nikolaus Rathd41f62c2017-09-12 14:01:04 +010058 $ mkdir build; cd build
Nikolaus Rath9f96db72017-01-05 09:37:00 -080059 $ meson ..
Nikolaus Rathdfbfd132015-12-20 13:52:30 -080060
Nikolaus Rath9f96db72017-01-05 09:37:00 -080061Normally, the default build options will work fine. If you
Craig Chi032db1a2020-07-03 04:28:05 -070062nevertheless want to adjust them, you can do so with the
63*meson configure* command:
Nikolaus Rath59e58de2016-03-29 15:30:57 -070064
Craig Chi032db1a2020-07-03 04:28:05 -070065 $ meson configure # list options
66 $ meson configure -D disable-mtab=true # set an option
Nikolaus Rath59e58de2016-03-29 15:30:57 -070067
John Baber-Luceroe6df67c2021-01-12 05:41:35 -050068To build, test, and install libfuse, you then use Ninja:
Nikolaus Rathdfbfd132015-12-20 13:52:30 -080069
Nikolaus Rath9f96db72017-01-05 09:37:00 -080070 $ ninja
Nikolaus Rathe372d612017-04-10 17:08:58 -070071 $ sudo python3 -m pytest test/
Nikolaus Rath9f96db72017-01-05 09:37:00 -080072 $ sudo ninja install
73
74Running the tests requires the [py.test](http://www.pytest.org/)
75Python module. Instead of running the tests as root, the majority of
Nikolaus Rathe372d612017-04-10 17:08:58 -070076tests can also be run as a regular user if *util/fusermount3* is made
77setuid root first:
Nikolaus Rath9f96db72017-01-05 09:37:00 -080078
79 $ sudo chown root:root util/fusermount3
80 $ sudo chmod 4755 util/fusermount3
Nikolaus Rathe372d612017-04-10 17:08:58 -070081 $ python3 -m pytest test/
Nikolaus Rath9f96db72017-01-05 09:37:00 -080082
Nikolaus Rathdfbfd132015-12-20 13:52:30 -080083Security implications
84---------------------
85
Nikolaus Rath9f96db72017-01-05 09:37:00 -080086The *fusermount3* program is installed setuid root. This is done to
87allow normal users to mount their own filesystem implementations.
Nikolaus Rathdfbfd132015-12-20 13:52:30 -080088
Nikolaus Rath9e3147f2017-01-12 10:10:34 -080089To limit the harm that malicious users can do this way, *fusermount3*
90enforces the following limitations:
Nikolaus Rathdfbfd132015-12-20 13:52:30 -080091
Emily Herbert74596e22019-10-24 17:46:19 -040092 - The user can only mount on a mountpoint for which they have write
Nikolaus Rathdfbfd132015-12-20 13:52:30 -080093 permission
94
Nikolaus Rath9e3147f2017-01-12 10:10:34 -080095 - The mountpoint must not be a sticky directory which isn't owned by
96 the user (like /tmp usually is)
Nikolaus Rathdfbfd132015-12-20 13:52:30 -080097
Nikolaus Rath43138fb2016-02-01 09:08:26 -080098 - No other user (including root) can access the contents of the
99 mounted filesystem (though this can be relaxed by allowing the use
Nikolaus Rath9e3147f2017-01-12 10:10:34 -0800100 of the *allow_other* and *allow_root* mount options in
101 */etc/fuse.conf*)
Nikolaus Rath43138fb2016-02-01 09:08:26 -0800102
Nikolaus Rathdfbfd132015-12-20 13:52:30 -0800103
Nikolaus Rath9e3147f2017-01-12 10:10:34 -0800104If you intend to use the *allow_other* mount options, be aware that
105FUSE has an unresolved [security
106bug](https://github.com/libfuse/libfuse/issues/15): if the
107*default_permissions* mount option is not used, the results of the
108first permission check performed by the file system for a directory
109entry will be re-used for subsequent accesses as long as the inode of
110the accessed entry is present in the kernel cache - even if the
111permissions have since changed, and even if the subsequent access is
112made by a different user. This is of little concern if the filesystem
113is accessible only to the mounting user (which has full access to the
114filesystem anyway), but becomes a security issue when other users are
115allowed to access the filesystem (since they can exploit this to
116perform operations on the filesystem that they do not actually have
117permissions for).
118
119This bug needs to be fixed in the Linux kernel and has been known
120since 2006 but unfortunately no fix has been applied yet. If you
121depend on correct permission handling for FUSE file systems, the only
122workaround is to use `default_permissions` (which does not currently
123support ACLs), or to completely disable caching of directory entry
124attributes.
125
Nikolaus Rathdfbfd132015-12-20 13:52:30 -0800126Building your own filesystem
127------------------------------
128
winndows717c8b82020-07-03 19:29:48 +0800129FUSE comes with several example file systems in the `example`
Nikolaus Rath1c08ee92016-10-16 15:05:57 -0700130directory. For example, the *passthrough* examples mirror the contents
131of the root directory under the mountpoint. Start from there and adapt
Nikolaus Rathdfbfd132015-12-20 13:52:30 -0800132the code!
133
134The documentation of the API functions and necessary callbacks is
135mostly contained in the files `include/fuse.h` (for the high-level
Nikolaus Ratha1e8fc92016-01-28 18:00:24 -0800136API) and `include/fuse_lowlevel.h` (for the low-level API). An
137autogenerated html version of the API is available in the `doc/html`
138directory and at http://libfuse.github.io/doxygen.
Nikolaus Rathdfbfd132015-12-20 13:52:30 -0800139
140
141Getting Help
142------------
143
144If you need help, please ask on the <fuse-devel@lists.sourceforge.net>
145mailing list (subscribe at
146https://lists.sourceforge.net/lists/listinfo/fuse-devel).
147
148Please report any bugs on the GitHub issue tracker at
Nikolaus Rath579c3b02015-12-21 19:17:47 -0800149https://github.com/libfuse/libfuse/issues.