diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-07-24 00:03:05 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-07-24 00:03:05 -0700 |
| commit | 5956dfd08d690ee67bcd4a7f5730785f7a6df201 (patch) | |
| tree | 0ec5f401c2129e9ea5bb9e21b3acfe3d0f5dafe3 /weed/command | |
| parent | 3f851feb59d9ffc80ac366222435eb54f98456ad (diff) | |
| download | seaweedfs-5956dfd08d690ee67bcd4a7f5730785f7a6df201.tar.xz seaweedfs-5956dfd08d690ee67bcd4a7f5730785f7a6df201.zip | |
mount: add umask option
related to https://github.com/chrislusf/seaweedfs/issues/978
Diffstat (limited to 'weed/command')
| -rw-r--r-- | weed/command/mount.go | 2 | ||||
| -rw-r--r-- | weed/command/mount_std.go | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/weed/command/mount.go b/weed/command/mount.go index ec790c999..71c1a4387 100644 --- a/weed/command/mount.go +++ b/weed/command/mount.go @@ -17,6 +17,7 @@ type MountOptions struct { chunkSizeLimitMB *int dataCenter *string allowOthers *bool + umaskString *string } var ( @@ -37,6 +38,7 @@ func init() { mountOptions.chunkSizeLimitMB = cmdMount.Flag.Int("chunkSizeLimitMB", 4, "local write buffer size, also chunk large files") mountOptions.dataCenter = cmdMount.Flag.String("dataCenter", "", "prefer to write to the data center") mountOptions.allowOthers = cmdMount.Flag.Bool("allowOthers", true, "allows other users to access the file system") + mountOptions.umaskString = cmdMount.Flag.String("umask", "022", "octal umask, e.g., 022, 0111") mountCpuProfile = cmdMount.Flag.String("cpuprofile", "", "cpu profile output file") mountMemProfile = cmdMount.Flag.String("memprofile", "", "memory profile output file") } diff --git a/weed/command/mount_std.go b/weed/command/mount_std.go index 1d1214266..0519ae7b8 100644 --- a/weed/command/mount_std.go +++ b/weed/command/mount_std.go @@ -27,6 +27,12 @@ func runMount(cmd *Command, args []string) bool { util.SetupProfiling(*mountCpuProfile, *mountMemProfile) + umask, umaskErr := strconv.ParseUint(*mountOptions.umaskString, 8, 64) + if umaskErr != nil { + fmt.Printf("can not parse umask %s", *mountOptions.umaskString) + return false + } + return RunMount( *mountOptions.filer, *mountOptions.filerMountRootPath, @@ -38,11 +44,12 @@ func runMount(cmd *Command, args []string) bool { *mountOptions.allowOthers, *mountOptions.ttlSec, *mountOptions.dirListingLimit, + os.FileMode(umask), ) } func RunMount(filer, filerMountRootPath, dir, collection, replication, dataCenter string, chunkSizeLimitMB int, - allowOthers bool, ttlSec int, dirListingLimit int) bool { + allowOthers bool, ttlSec int, dirListingLimit int, umask os.FileMode) bool { util.LoadConfiguration("security", false) @@ -146,6 +153,7 @@ func RunMount(filer, filerMountRootPath, dir, collection, replication, dataCente MountMode: mountMode, MountCtime: fileInfo.ModTime(), MountMtime: time.Now(), + Umask: umask, })) if err != nil { fuse.Unmount(dir) |
