diff --git a/weed/command/s3.go b/weed/command/s3.go index afd7a8f9c..e84a4f45d 100644 --- a/weed/command/s3.go +++ b/weed/command/s3.go @@ -68,7 +68,7 @@ type S3Options struct { func init() { cmdS3.Run = runS3 // break init cycle s3StandaloneOptions.filer = cmdS3.Flag.String("filer", "localhost:8888", "comma-separated filer server addresses for high availability") - s3StandaloneOptions.bindIp = cmdS3.Flag.String("ip.bind", "", "ip address to bind to. Default to localhost.") + s3StandaloneOptions.bindIp = cmdS3.Flag.String("ip.bind", "", "ip address to bind to. If empty, default to 0.0.0.0.") s3StandaloneOptions.port = cmdS3.Flag.Int("port", 8333, "s3 server http listen port") s3StandaloneOptions.portHttps = cmdS3.Flag.Int("port.https", 0, "s3 server https listen port") s3StandaloneOptions.portGrpc = cmdS3.Flag.Int("port.grpc", 0, "s3 server grpc listen port") @@ -302,7 +302,7 @@ func (s3opt *S3Options) startS3Server() bool { *s3opt.portGrpc = 10000 + *s3opt.port } if *s3opt.bindIp == "" { - *s3opt.bindIp = "localhost" + *s3opt.bindIp = "0.0.0.0" } if runtime.GOOS != "windows" { diff --git a/weed/command/sftp.go b/weed/command/sftp.go index f1a0d9e09..58cc5b14a 100644 --- a/weed/command/sftp.go +++ b/weed/command/sftp.go @@ -60,7 +60,7 @@ func init() { cmdSftp.Run = runSftp sftpOptionsStandalone.filer = cmdSftp.Flag.String("filer", "localhost:8888", "filer server address (ip:port)") - sftpOptionsStandalone.bindIp = cmdSftp.Flag.String("ip.bind", "0.0.0.0", "ip address to bind SFTP server") + sftpOptionsStandalone.bindIp = cmdSftp.Flag.String("ip.bind", "", "ip address to bind to. If empty, default to 0.0.0.0.") sftpOptionsStandalone.port = cmdSftp.Flag.Int("port", 2022, "SFTP server listen port") sftpOptionsStandalone.sshPrivateKey = cmdSftp.Flag.String("sshPrivateKey", "", "path to the SSH private key file for host authentication") sftpOptionsStandalone.hostKeysFolder = cmdSftp.Flag.String("hostKeysFolder", "", "path to folder containing SSH private key files for host authentication") @@ -95,6 +95,9 @@ func runSftp(cmd *Command, args []string) bool { } func (sftpOpt *SftpOptions) startSftpServer() bool { + if *sftpOpt.bindIp == "" { + *sftpOpt.bindIp = "0.0.0.0" + } filerAddress := pb.ServerAddress(*sftpOpt.filer) grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client")