mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
mount: add option to disable allow others
fix https://github.com/chrislusf/seaweedfs/issues/877
This commit is contained in:
parent
ad08a52ab6
commit
6fe071175d
|
@ -17,6 +17,7 @@ type MountOptions struct {
|
||||||
ttlSec *int
|
ttlSec *int
|
||||||
chunkSizeLimitMB *int
|
chunkSizeLimitMB *int
|
||||||
dataCenter *string
|
dataCenter *string
|
||||||
|
allowOthers *bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -37,6 +38,7 @@ func init() {
|
||||||
mountOptions.ttlSec = cmdMount.Flag.Int("ttl", 0, "file ttl in seconds")
|
mountOptions.ttlSec = cmdMount.Flag.Int("ttl", 0, "file ttl in seconds")
|
||||||
mountOptions.chunkSizeLimitMB = cmdMount.Flag.Int("chunkSizeLimitMB", 4, "local write buffer size, also chunk large files")
|
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.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")
|
||||||
mountCpuProfile = cmdMount.Flag.String("cpuprofile", "", "cpu profile output file")
|
mountCpuProfile = cmdMount.Flag.String("cpuprofile", "", "cpu profile output file")
|
||||||
mountMemProfile = cmdMount.Flag.String("memprofile", "", "memory profile output file")
|
mountMemProfile = cmdMount.Flag.String("memprofile", "", "memory profile output file")
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,8 +56,7 @@ func runMount(cmd *Command, args []string) bool {
|
||||||
|
|
||||||
util.SetupProfiling(*mountCpuProfile, *mountMemProfile)
|
util.SetupProfiling(*mountCpuProfile, *mountMemProfile)
|
||||||
|
|
||||||
c, err := fuse.Mount(
|
options := []fuse.MountOption{
|
||||||
*mountOptions.dir,
|
|
||||||
fuse.VolumeName("SeaweedFS"),
|
fuse.VolumeName("SeaweedFS"),
|
||||||
fuse.FSName("SeaweedFS"),
|
fuse.FSName("SeaweedFS"),
|
||||||
fuse.Subtype("SeaweedFS"),
|
fuse.Subtype("SeaweedFS"),
|
||||||
|
@ -67,13 +66,17 @@ func runMount(cmd *Command, args []string) bool {
|
||||||
fuse.AutoXattr(),
|
fuse.AutoXattr(),
|
||||||
fuse.ExclCreate(),
|
fuse.ExclCreate(),
|
||||||
fuse.DaemonTimeout("3600"),
|
fuse.DaemonTimeout("3600"),
|
||||||
fuse.AllowOther(),
|
|
||||||
fuse.AllowSUID(),
|
fuse.AllowSUID(),
|
||||||
fuse.DefaultPermissions(),
|
fuse.DefaultPermissions(),
|
||||||
fuse.MaxReadahead(1024*128),
|
fuse.MaxReadahead(1024 * 128),
|
||||||
fuse.AsyncRead(),
|
fuse.AsyncRead(),
|
||||||
fuse.WritebackCache(),
|
fuse.WritebackCache(),
|
||||||
)
|
}
|
||||||
|
if *mountOptions.allowOthers {
|
||||||
|
options = append(options, fuse.AllowOther())
|
||||||
|
}
|
||||||
|
|
||||||
|
c, err := fuse.Mount(*mountOptions.dir, options...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatal(err)
|
glog.Fatal(err)
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in a new issue