All Products
Search
Document Center

:put-object-acl

Last Updated:Apr 02, 2025

The put-object-acl command is used to set or modify the access control list (ACL) of an object.

Usage notes

  • By default, an Alibaba Cloud account has the permissions to set the ACL of an object. Setting the ACL as a RAM user or by using Security Token Service (STS) requires oss:PutObjectAcl permission. For more information, see Attach a custom policy to a RAM user.

    Only the bucket owner that has permissions to read and write objects in the bucket can call this operation to modify the ACLs of the object.

  • The ACL of an object takes precedence over the ACL of the bucket in which the object is stored. For example, if an object whose ACL is public-read-write is stored in a bucket whose ACL is private, all users can read and write the object.

Command syntax

ossutil api put-object-acl --bucket value --key value --object-acl value [flags]

Parameter

Type

Description

--bucket

string

Name of the bucket.

--key

string

Full path of the object.

--object-acl

string

ACL of the object. Valid values:

  • private

  • public-read

  • public-read-write

  • default (The object inherits the ACL from the bucket.)

--version-id

string

Version ID of the object.

Note
  • The put-object-acl command corresponds to the PutObjectACL operation. For more information about the parameters in the PutObjectACL operation, see PutObjectACL.

  • For more information about supported global command-line options, see Command-line options.

Example

Set the ACL of examplebucket to private.

ossutil api put-object-acl --bucket examplebucket --key exampleobject --object-acl private