以下是控制訪問整個Bucket的代碼
{
"Version": "1",
"Statement": [
{
"Effect": "Allow",
"Action": "oss:ListBuckets",
"Resource": "acs:oss:*:*:*"
},
{
"Effect": "Allow",
"Action": "oss:Listobjects",
"Resource": "acs:oss:*:*:bz-bh"
},
{
"Effect": "Allow",
"Action": "oss:GetObject",
"Resource": "acs:oss:*:*:bz-bh"
}
]
}
bz-bh為Bucket
------------以下是控制訪問一級目錄的代碼
{
"Statement": [
{
"Effect": "Allow",
"Action": "oss:*",
"Resource": "acs:oss:*:*:yiskyxm/ahzl.msz315.com/*"
},
{
"Effect": "Allow",
"Action": "oss:ListObjects",
"Resource": "acs:oss:*:*:yiskyxm",
"Condition": {
"StringLike": {
"oss:Prefix": [
"",
"ahzl.msz315.com/",
"ahzl.msz315.com/*"
]
},
"StringEquals": {
"oss:Delimiter": "/"
}
}
},
{
"Effect": "Allow",
"Action": "oss:ListBuckets",
"Resource": "acs:oss:*:*:*"
}
],
"Version": "1"
}
如果想讓RAM用戶無法刪除文件,則把刪除權限(紅底部分)去掉即可