You can call this operation to configure or modify the ACL of a bucket.
Usage notes
When you call the PutBucketAcl operation, take note of the following items:
To call this operation, you must have write permissions on the bucket.
PutBucketAcl uses the overwriting semantics. A new ACL overwrites the existing one.
If the specified bucket for which you want to set ACL does not exist when you call this operation, a new bucket is created.
Request structure
PUT /? acl HTTP/1.1
x-oss-acl: Permission
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue
Request headers
Header | Type | Required | Sample value | Description |
Header | Type | Required | Sample value | Description |
x-oss-acl | String | Yes | private | The ACL that you want to set for the bucket. This header is included in PutBucketAcl requests to set the ACL of the bucket. If this header is not included, the ACL settings do not take effect. Valid values: public-read-write, public-read, and private public-read-write: Any users, including anonymous users can read and write objects in the bucket. Exercise caution when you set the ACL of a bucket to public-read-write. public-read: Only the owner or authorized users of this bucket can write objects in the bucket. Other users, including anonymous users can only read objects in the bucket. Exercise caution when you set the ACL of a bucket to public-read. private: Only the owner or authorized users of this bucket can read and write objects in the bucket. Other users, including anonymous users cannot access the objects in the bucket without authorization.
|
For the common request headers included in PutBucketAcl requests, see Common request headers.
Response headers
The response to a PutBucketAcl request contains only common response headers. For more information, see Common response headers.
Examples
Sample request
PUT /? acl HTTP/1.1
x-oss-acl: public-read
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 24 Feb 2012 03:21:12 GMT
Authorization: OSS qn6q**************:77Dv****************
OSS SDKs
You can use OSS SDKs for the following programming languages to call the PutBucketAcl operation:
ossutil
For information about the ossutil command that corresponds to the PutBucketAcl operation, see put-bucket-acl.
Error codes
Error code | HTTP status code | Description |
Error code | HTTP status code | Description |
AccessDenied | 403 | The error message returned because the information for user authentication is not included in the PutBucketAcl request. The error message returned because you are not authorized to initiate a PutBucketAcl request.
|