mc config host add
可以选择跳过凭据验证。
mc config host add s3-somebucket https://s3.cn-north-1.amazonaws.com.cn XXXXX XXXXXXXXXX S3v4
mc: <ERROR> Unable to initialize new config from the provided credentials. The specified bucket does not exist.
这是我的s3 iam政策:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1506154426000",
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": [
"arn:aws-cn:s3:::somebucket/*"
]
},
{
"Sid": "Stmt1506154452000",
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": [
"arn:aws-cn:s3:::somebucket"
]
}
]
}
在旧版本的mc中,添加凭据时不会对其进行验证。
我对我的s3访问密钥给予了非常严格的许可。 因此它确实是这样的:
访问密钥无法列出存储桶名称。
在macOS,Ubuntu 16.04上测试
您可以直接提供--api s3v4
,并且不应调用验证调用路径。
@ tru2dagame关闭此问题的答案。 否则,请随时重新打开该问题。
答案有些混乱,因为(https://docs.minio.io/docs/minio-client-complete-guide)将s3v4
指定为默认值。 使用--api
选项对我明确起作用(macos mc版本2018-03-25T01)。 如果没有该选项,我将看到与此处报告的错误相同的错误。
@rbetts如果提供了选项--api
,则跳过凭据验证。 如果您未指定该选项,则它将进行验证,这在您的情况下将失败。 将研究在文档中添加选项
没有--api s3v4
参数, mc
需要什么确切的授权? 我在下面给s3用户授权,但是它仍然无法正常工作。
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": "arn:aws-cn:s3:::<my-bucket>"
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject"
],
"Resource": "arn:aws-cn:s3:::<my-bucket>/*"
},
{
"Sid": "VisualEditor2",
"Effect": "Allow",
"Action": "s3:GetBucketLocation",
"Resource": "arn:aws-cn:s3:::<my-bucket>"
},
{
"Sid": "VisualEditor3",
"Effect": "Allow",
"Action": "s3:ListAllMyBuckets",
"Resource": "*"
}
]
}
我使用了这样的命令,并在下面收到错误消息:
$ docker run -it --entrypoint=/bin/sh minio/mc:RELEASE.2018-05-25T20-20-15Z
$ mc config host add s3 <endpoint> <key> <secret>; mc ls s3/<my-bucket>
mc: Configuration written to `/root/.mc/config.json`. Please update your access credentials.
mc: Successfully created `/root/.mc/share`.
mc: Initialized share uploads `/root/.mc/share/uploads.json` file.
mc: Initialized share downloads `/root/.mc/share/downloads.json` file.
mc: <ERROR> Unable to initialize new config from the provided credentials. The specified bucket does not exist.
mc: <ERROR> Unable to stat `<my-bucket>`. Requested file `<my-bucket>` not found
如果我添加--api s3v4
参数,一切正常。
您可以直接提供--api s3v4,并且不应调用验证调用路径。
这对我有用。 但是,如果不进行尝试或不访问此问题,这将非常令人困惑且无法理解。
mc config host add
可以在--api
参数附近有一个解释,说这将阻止主动探测。
还添加了--debug
输出*什么也没有*,该命令只是空着眼睛看着我一分钟以上.. :: /
最有用的评论
您可以直接提供
--api s3v4
,并且不应调用验证调用路径。