All Products
Search
Document Center

Object Storage Service:How do I set the ACLs of files in a folder of a public-read bucket to private?

Last Updated:Nov 20, 2025

To set the access control lists (ACLs) for files in a folder of a public-read bucket to private, you can use the ossutil 2.0 command line interface (CLI) for batch operations or set the ACLs individually in the console.

Method 1: Perform batch operations with ossutil (Recommended)

You can use the set-props (set object attributes) command in ossutil 2.0 to recursively change the ACLs of all files in a folder.

Syntax

ossutil set-props oss://<bucket_name>/<folder_name> --acl private -r -f
  • --acl private: The --acl option sets the object ACL. The private value specifies that the object is private.

  • -r: Performs a recursive operation on all files in the folder.

  • -f: Forces the command to run without prompting for confirmation for each file.

Example

Set all files in the data/ folder of the examplebucket bucket to private:

ossutil set-props oss://examplebucket/data/ --acl private -r -f

Method 2: Set ACLs individually

If you have a small number of files, you can set the ACL for each file to private in the console. For more information, see Set Object ACLs.