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--acloption sets the object ACL. Theprivatevalue 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 -fMethod 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.