You need to enable JavaScript to run this app.
Torch Object Storage

Torch Object Storage

Copy page
Download PDF
Common commands
Set predefined access control lists for buckets or objects (set-acl)
Copy page
Download PDF
Set predefined access control lists for buckets or objects (set-acl)
You can use the set-acl command to set predefined access control lists (ACLs) for buckets or objects.​
Setting bucket ACL​
Command syntax​
​
Linux/macOS
Windows
​
​
​
./tosutil set-acl tos://bucket acl [-e=xxx] [-re=xxx] [-i=xxx] [-k=xxx] [-t=xxx] [-conf=xxx]​
​
​
​
​
Parameters​
For descriptions of common optional parameters, see Global options.​
​
Parameter​
Type​
Description​
bucket​
String​
Bucket name.​
acl​
Enum​
Sets the predefined ACLs for buckets. The options are as follows:​
  • private: The bucket is private. This is the default value.​
  • public-read: Publicly readable.​
  • public-read-write: Publicly readable and writable.​
  • authenticated-read: Authenticated users have read access.​
  • bucket-owner-read: The bucket owner has read access.​
  • bucket-owner-full-control: The bucket owner has full control.​
​
Example​
Use the following command to set the predefined ACL for the bucketname bucket to public-read.​
  • Command​
​
./tosutil set-acl tos://bucketname public-read​
​
  • Output​
​
Start at 2024-01-22 10:42:49.230198 +0000 UTC​
​
Set acl for bucket [bucketname] successfully!​
​
Setting object ACL​
Command syntax​
​
return (<Tabs>​
<Tabs.TabPane title="Linux/macOS" key="xO8dEDsHE8"><RenderMd content={`* Set the predefined ACL for an object​
\`\`\`Bash​
./tosutil set-acl tos://bucket/key acl [-versionId=xxx] [-fr] [-o=xxx] [-bt=xxx] [-e=xxx] [-re=xxx] [-i=xxx] [-k=xxx] [-t=xxx] [-conf=xxx]​
\`\`\`​
​
* Set the predefined ACLs for objects in batches​
\`\`\`Bash​
./tosutil set-acl tos://bucket/[prefix] acl -r [-j=1] [-v] [-include=*.xxx] [-exclude=*.xxx] [-o=xxx] [-bt=xxx] [-e=xxx] [-re=xxx] [-i=xxx] [-k=xxx] [-t=xxx] [-conf=xxx]​
\`\`\`​
​
`}></RenderMd></Tabs.TabPane>​
<Tabs.TabPane title="Windows" key="bmvbG4UN3V"><RenderMd content={`​
`}></RenderMd></Tabs.TabPane></Tabs>);​
​
Parameters​
For descriptions of common optional parameters, see Global options.​
​
Parameter​
Type​
Description​
bucket​
String​
Bucket name.​
key​
String​
Object name.​
prefix​
String​
The prefix used for filtering objects in batch operations.​
acl​
Enum​
Sets the predefined ACLs for objects. Possible values:​
  • private​
  • public-read​
  • public-read-write​
  • authenticated-read​
  • bucket-owner-read​
  • bucket-owner-full-control​
  • bucket-owner-entrusted​
-r​
Bool​
Set the predefined ACLs for objects in batches.​
-j​
Integer​
The maximum concurrency for setting the predefined ACLs for objects in batches. This value is set to the defaultJobs value in the configuration file by default.​
-v​
Bool​
Sets the predefined ACLs in batches for objects with multiple versions that share the specified prefix.​
-versionId​
String​
The version ID of an object whose perdefined ACL is to be set.​
-include​
String​
The object matching pattern used to include objects when setting the predefined ACLs in batches. The following characters have special behavior:​
  • ? : Matches any single character within an object name.​
  • *: Matches zero or more characters within an object name.​
  • #: Serves as a delimiter.​
For example, -include=*.png#*.txt matches all objects ending in .png and .txt.​
tip​
  • To avoid parsing failures caused by the operating system escaping special characters, enclose the object matching pattern in quotes.​
  • This pattern only takes effect when uploading folders or a list of objects.​
-exclude​
String​
The object matching pattern used to exclude objects when setting the predefined ACLs in batches. The following characters have special behavior:​
  • ? : Matches any single character within an object name.​
  • *: Matches zero or more characters within an object name.​
  • #: Serves as a delimiter.​
For example, -exclude=*.png#*.txt matches all objects ending in .png and .txt.​
tip​
  • To avoid parsing failures caused by the operating system escaping special characters, enclose the object matching pattern in quotes.​
  • This pattern only takes effect when uploading folders or a list of objects.​
-fr​
Bool​
Generate a result file when setting the predefined ACL for an object.​
-o​
String​
The folder where result files are stored. The default location is specified in the configuration file as defaultOutputDir.​
-bt​
String​
The type of the bucket. The options are as follows:​
  • fns: A flat namespace (FNS) bucket.​
  • hns: A hierarchical namespace (HNS) bucket.​
If the bucket type is not specified, the default will be the type obtained from the bucket metadata.​
​
Examples​
Set the predefined ACL for an object​
Use the following command to set the predefined ACL for the object.png object in the bucketname bucket to public-read.​
  • Command​
  • ​
    ./tosutil set-acl tos://bucketname/object.png public-read​
    ​
  • Output​
  • ​
    Start at 2024-01-22 14:22:15.66498 +0000 UTC​
    ​
    Set acl for object [object.png] in the bucket [bucketname] successfully, cost [179], request id [f06701ae7a17971865ae7a17-b293fe0-1rRvBn-POA-cb-tos-front-azc-1]​
    ​
Set the predefined ACLs for objects in batches​
Use the following command to set the predefined ACLs for objects with the object prefix in the bucketname bucket to public-read.​
  • Command​
  • ​
    ./tosutil set-acl tos://bucketname/object public-read -r​
    ​
  • Output​
  • ​
    Start at 2024-01-22 14:23:36.625134 +0000 UTC​
    ​
    [--------------------------------------------------------------------------------------------] 100.00% tps:0.00 1/1 90ms​
    Succeed count is: 1 Failed count is: 0​
    Metrics [max cost:46 ms, min cost:46 ms, average cost:46.00 ms, average tps:10.99]​
    ​
    Task id is: d4b331fc-b931-11ee-8422-b645e1163e55​
    ​
​
​
Last updated: 2025.12.17 18:33:44