From 23cc0657f43c21a4f249594a5dcc660b2d5fb77a Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 26 Jun 2016 19:18:13 +0200 Subject: fusefronted: preserve owner if running as root If allow_other is set and we run as root, try to give newly created files to the right user. --- main.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index b7ff97d..c87cc87 100644 --- a/main.go +++ b/main.go @@ -374,6 +374,11 @@ func initFuseFrontend(key []byte, args argContainer, confFile *configfile.ConfFi // Settings from the config file override command line args frontendArgs.PlaintextNames = confFile.IsFeatureFlagSet(configfile.FlagPlaintextNames) } + // 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 { + frontendArgs.PreserveOwner = true + } jsonBytes, _ := json.MarshalIndent(frontendArgs, "", "\t") tlog.Debug.Printf("frontendArgs: %s", string(jsonBytes)) -- cgit v1.2.3