我正在尝试限制拒绝特定用户列表,读取和写入我的存储桶中特定文件夹的访问权限。我能够允许用户查看其他文件夹,但在向帐户添加拒绝策略(通过组添加)时,我收到拒绝访问的消息。
这就是我拒绝访问的内容:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": "arn:aws:s3:::*"
},
{
"Effect": "Deny",
"Action": [
"s3:ListBucket"
],
"Resource": "arn:aws:s3:::myBucket",
"Condition": {
"StringLike": {
"s3:prefix": "Admin/*"
}
}
}
]
}
理论上,我想限制某个用户无法对Admin文件夹执行上述操作,但是他们仍然需要能够查看其他文件夹的存储桶。
我也尝试过:
{
"Id": "Policy",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1516743098844",
"Action": [
"s3:GetBucketLocation",
"s3:PutObject",
"s3:GetObject"
],
"Effect": "Deny",
"Resource": "arn:aws:s3:::mybucket/Admin/*",
"Principal": {
"AWS": [
"arn:aws:iam::11111111:user/Jenny"
]
}
}
]
}
上述两个JSON语句都是使用S3生成器策略和IAM策略的策略生成器创建的。
有关如何拒绝列表访问文件夹但允许查看存储桶的任何线索?
答案 0 :(得分:0)
你的第一句话对我来说非常好!
$ aws s3 ls s3://my-bucket/
PRE Admin/
PRE other/
2018-01-23 16:33:07 15091 cat.jpg
$ aws s3 ls s3://my-bucket/other/
2018-01-23 16:34:02 91 foo
$ aws s3 ls s3://my-bucket/Admin/
An error occurred (AccessDenied) when calling the ListObjects operation: Access Denied