Skip to content

Add opt-in no_default_permissions mount option (read foreign-uid files without root) - #155

Open
moonsoup wants to merge 2 commits into
alperakcan:masterfrom
moonsoup:no-default-permissions
Open

Add opt-in no_default_permissions mount option (read foreign-uid files without root)#155
moonsoup wants to merge 2 commits into
alperakcan:masterfrom
moonsoup:no-default-permissions

Conversation

@moonsoup

@moonsoup moonsoup commented Jul 5, 2026

Copy link
Copy Markdown

Adds an opt-in -o no_default_permissions mount option.

By default fuse-ext2 mounts with the kernel's default_permissions, which
enforces the on-disk mode/owner bits. When reading a filesystem recovered from
another machine, files are often owned by a uid that doesn't exist on the host,
so the mounting user is denied access to their own recovered data and has to
fall back to mounting everything as root.

With -o no_default_permissions, default_permissions is omitted, letting the
(root-privileged) fuse-ext2 daemon serve those files to the mounting user
regardless of the foreign on-disk uid. It's off by default — the kernel still
enforces permissions unless explicitly requested. To make this possible,
default_permissions is now appended in parse_mount_options() rather than
hardcoded in def_opts, so it can be conditionally suppressed.

Testing

On macOS 26.5.1 / macFUSE 5.2: a mode-0750 file owned by a foreign uid (1000)
is unreadable by the local user under a default mount, and readable with
-o no_default_permissions. Read-only verification still passes on
ext2/ext3/ext4. Single-environment test only.

Note

This branch is based on #154 (the macOS getxattr build fix) and includes that
commit, since the tree doesn't compile on macOS without it. If #154 merges
first I'll rebase so this shows only the no_default_permissions change.

moonsoup and others added 2 commits July 5, 2026 15:43
macOS FUSE implementations (macFUSE, FUSE-T) declare the getxattr
operation with an extra trailing `uint32_t position` argument — the
Darwin resource-fork xattr convention. Assigning the shared 4-arg
op_getxattr to .getxattr then fails to compile with an
incompatible-function-pointer-type error (ref upstream issue alperakcan#143).

Add an __APPLE__-only shim that accepts and ignores `position` and
defers to the existing op_getxattr. No behavior change on Linux/BSD;
ext2 has no resource-fork concept, so dropping `position` is correct.
The #ifdef keeps the non-Darwin build using the 4-arg op_getxattr
unchanged.

Tested: builds and mounts read-only on macOS 26.5.1 (Apple Silicon,
Darwin 25.5.0), macFUSE 5.2, Apple clang; read-only verification passes
on ext2/ext3/ext4 throwaway images. Single-environment test only;
broader platform testing not yet done.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
By default fuse-ext2 mounts with the kernel's `default_permissions`, which
enforces the on-disk mode/owner bits. When reading a filesystem recovered
from another machine, files are often owned by a uid that does not exist on
the host, so the mounting user is denied access to their own recovered data
and must fall back to mounting everything as root.

Add an opt-in `-o no_default_permissions` that omits `default_permissions`,
letting the (root-privileged) fuse-ext2 daemon serve those files to the
mounting user regardless of the foreign on-disk uid. Off by default — the
kernel still enforces permissions unless explicitly requested. To allow this,
`default_permissions` is now appended in parse_mount_options() rather than
hardcoded in def_opts, so it can be conditionally suppressed.

Tested on macOS 26.5.1 / macFUSE 5.2: a mode-0750 file owned by a foreign
uid (1000) is unreadable by the local user under a default mount but readable
with -o no_default_permissions; read-only verification still passes on
ext2/ext3/ext4. Single-environment test only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
moonsoup added a commit to moonsoup/fuse-ext2 that referenced this pull request Jul 5, 2026
Replaces the outdated README (osxfuse references, a 100-line copy-paste
/opt/gnu build script, obscure caveats) with a focused install + usage guide:

- Install via `brew install moonsoup/fuse-ext2/fuse-ext2` (new tap) or from
  source with the macFUSE/e2fsprogs flags that actually work on current macOS.
- Read-only mount usage, incl. the no_default_permissions option for reading
  drives recovered from another machine.
- Points to the upstream PRs (alperakcan#154, alperakcan#155) for the fixes.

Also gitignore autoconf backup junk (config.*~) and CLAUDE.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant