我希望限制用户仅在dir1中上传和列出对象,但它能够列出桶的所有前缀。它只能上传到所需的dir1。如何修改策略,使user1只可以列出和上传dir1的对象?
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowListingOfUserFolder",
"Action": [
"s3:ListBucket"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::mybucket"
]
},
{
"Sid": "HomeDirObjectAccess",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject"
],
"Resource": "arn:aws:s3:::mybucket/dir1/*"
}
]
}发布于 2022-11-09 04:44:04
ListBucket命令(它在桶中显示对象)接受如下所示的Condition:
{
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::my-bucket",
"Condition":
"StringLike": {
"s3:prefix": "dir1/*
}
}这将允许列出存储桶的内容,但前提是前缀以dir1/开头。
https://stackoverflow.com/questions/74368126
复制相似问题