Skip to content

Commit

Permalink
Add option to unset allow_other option for FUSE for target-mount (#844)
Browse files Browse the repository at this point in the history
Fixes #683
  • Loading branch information
Poeloe authored Sep 12, 2024
1 parent f2b2a24 commit acb8d15
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions dissect/target/tools/mount.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,24 @@ def main():
options = parse_options_string(args.options) if args.options else {}

options["nothreads"] = True
options["allow_other"] = True
options["ro"] = True

print(f"Mounting to {args.mount} with options: {_format_options(options)}")
# Check if the allow other option is either not set (None) or set to True with -o allow_other=True
if (allow_other := options.get("allow_other")) is None or str(allow_other).lower() == "true":
options["allow_other"] = True
# If allow_other was not set, warn the user that it will be set by default
if allow_other is None:
log.warning("Using option 'allow_other' by default, please use '-o allow_other=False' to unset")
# Let the user be able to unset the allow_other option by supplying -o allow_other=False
elif str(allow_other).lower() == "false":
options["allow_other"] = False

log.info("Mounting to %s with options: %s", args.mount, _format_options(options))
try:
FUSE(DissectMount(vfs), args.mount, **options)
except RuntimeError:
parser.exit("FUSE error")
except RuntimeError as e:
log.error("Mounting target %s failed", t)
log.debug("", exc_info=e)
parser.exit(1)


def _format_options(options: dict[str, Union[str, bool]]) -> str:
Expand Down

0 comments on commit acb8d15

Please sign in to comment.