Skip to content

Commit 6ef3d8a

Browse files
authored
fix: show clear error message when mounting FUSE without root (#14)
## Summary - Detect `PermissionDenied` error from `fuser::Session::new()` and display a helpful message with the exact `sudo` command to re-run, instead of a raw OS error. Closes #10
1 parent 67ee484 commit 6ef3d8a

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/fuse.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,15 @@ pub fn mount_fuse(
414414
let session = match fuser::Session::new(adapter, mount_point, &config) {
415415
Ok(s) => s,
416416
Err(e) => {
417-
error!("FUSE session failed: {}", e);
417+
if e.kind() == std::io::ErrorKind::PermissionDenied {
418+
error!(
419+
"Permission denied: mounting a FUSE filesystem requires root privileges. \
420+
Try running with: sudo {}",
421+
std::env::args().collect::<Vec<_>>().join(" ")
422+
);
423+
} else {
424+
error!("FUSE session failed: {}", e);
425+
}
418426
std::process::exit(1);
419427
}
420428
};

0 commit comments

Comments
 (0)