diff options
author | Jakob Unterwurzacher | 2025-06-05 19:31:29 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2025-06-05 19:31:29 +0200 |
commit | 4358a9f998d469bf6aac077d76847498710c6b42 (patch) | |
tree | 3d00301be582c364880d696005d3a94095ab6b8f | |
parent | e55a637512131c21a7eb16574aba799abd2a336f (diff) |
Fixes https://github.com/rfjakob/gocryptfs/issues/783
-rw-r--r-- | mount.go | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -315,9 +315,13 @@ func initFuseFrontend(args *argContainer) (rootNode fs.InodeEmbedder, wipeKeys f } } } - // If allow_other is set and we run as root, try to give newly created files to - // the right user. - if args.allow_other && os.Getuid() == 0 { + // If allow_other is set and we run as root, create files as the accessing + // user. + // Except when -force_owner is set, because in this case the user may + // not have write permissions. And the point of -force_owner is to map uids, + // so we want the files on the backing dir to get the uid the gocryptfs process + // is running as. + if args.allow_other && os.Getuid() == 0 && args._forceOwner == nil { frontendArgs.PreserveOwner = true } |