10 releases
0.2.8 | Dec 8, 2023 |
---|---|
0.2.7 | Dec 3, 2023 |
0.2.6 | Sep 25, 2023 |
0.2.5 | Mar 24, 2023 |
0.1.0 | Dec 30, 2022 |
#1641 in Filesystem
53 downloads per month
23KB
485 lines
ForkFS
ForkFS allows you to sandbox a process's changes to your file system.
You can think of it as a lightweight container: programs still have access to your real system (and can therefore jump out of the sandbox), but their disk changes are re-routed to special directories without changing the real file system.
Installation
Note: ForkFS is Linux-only.
Use prebuilt binaries
Binaries for a number of platforms are available on the release page.
Build from source
$ cargo +nightly install forkfs
To install cargo, follow these instructions.
Usage
Run a command in the sandbox:
$ forkfs run -- <your command>
All file system changes the command makes will only exist within the sandbox and will not modify your real file system.
You can also start a bash shell wherein any command you execute has its file operations sandboxed:
$ forkfs run bash
More details:
$ forkfs --help
A sandboxing file system emulator
You can think of ForkFS as a lightweight container: programs still have access to your real system
(and can therefore jump out of the sandbox), but their disk changes are re-routed to special
directories without changing the real file system. Under the hood, ForkFS is implemented as a
wrapper around OverlayFS.
Warning: we make no security claims. Do NOT use this tool with potentially malicious software.
PS: you might also be interested in Firejail: <https://firejail.wordpress.com/>.
Usage: forkfs <COMMAND>
Commands:
run Run commands inside the sandbox
sessions Manage sessions
help Print this message or the help of the given subcommand(s)
Options:
-h, --help
Print help (use `-h` for a summary)
-V, --version
Print version
$ forkfs sessions --help
Manage sessions
Each session has its own separate view of the file system that is persistent. That is, individual
command invocations build upon each other.
Actives sessions are those that are mounted, while inactive sessions remember the changes that were
made within them, but are not ready to be used.
Note: weird things may happen if the real file system changes after establishing a session. You may
want to delete all sessions to restore clean behavior in such cases.
Usage: forkfs sessions <COMMAND>
Commands:
list List sessions
stop Unmount active sessions
delete Delete sessions
help Print this message or the help of the given subcommand(s)
Options:
-h, --help
Print help (use `-h` for a summary)
Dependencies
~3–13MB
~165K SLoC