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

Torch Object Storage

Copy page
Download PDF
Share objects
Create an authorization code (share-crt)
Copy page
Download PDF
Create an authorization code (share-crt)
You can use the share-crt command to create authorization codes. These codes allow you to share objects with others.​
Command syntax​
​
​
Linux/macOS
Windows
​
​
​
./tosutil share-crt tos://bucket[/prefix] [-vp=xxx] [-dst=xxx] [-em] [-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​
The bucket where the objects to be shared are located.​
prefix​
String​
The prefix used for filtering objects when sharing. The options are as follows:​
  • Empty value: This indicates that all objects in the bucket are to be shared.​
  • Non-empty value: Shares all objects whose names begin with this prefix.​
tip​
  • When setting this parameter, we recommend ending it with /.​
  • If you want to browse the shared objects with the specified prefix via a browser or TOS Browser, the parameter must end in a /.​
-vp​
String​
Sets how long an authorization code is valid. This period can range from one minute to seven days. If you use temporary access credentials to configure tosutil, the authorization code's validity period must match the credentials' expiration time.​
The default value is one day, indicating that the generated authorization code will expire after one day. This parameter supports the following configuration formats:​
  • w: Week(s).​
  • d: Day(s).​
  • h: Hour(s).​
  • min: Minute(s).​
  • s: Second(s).​
For example, 1d means a validity period of one day; 1w, one week; and 1h, one hour.​
tip​
If no time unit is specified, the default unit is seconds. For example, 2400 means a validity period of 2,400 seconds.​
-dst​
String​
The path to the authorization code.​
-em​
Bool​
Enable exact matching. This indicates that only a single object is to be shared.​
​
Examples​
Share all objects in a bucket​
Use the following command to share all objects in the bucketname bucket. The authorization code is valid for one hour.​
  • Command​
  • ​
    ./tosutil share-crt tos://bucketname -vp 1h ​
    ​
  • Output​
  • ​
    Authorization Code:​
    https://document-share.tos-cn-beijing.volces.com/index.html?token=/****+aY3yfy+JmQ2Yd144VAZ5FuFbHru0ADVaY5wZkCUQMZYifSKe5n1IL2WqrqLb/bzYMKl2lqdIZPG8dBL4XEXeKE9SqtS4n+f17aaSIBU3B288ly9ANNBJ7eaBCni7/UKKpK49ZfXxm0mCdbS9sFTNahK5IAesDvAqMQis7wTxRrrqSRG2zGgabYgTNbRWD2OklttTJPtSA4940kisfHOEQwWBZol7MVarJItDqVEeiT80wLa3pr+5gb/8ZtWrBBfCOjAkEJY7AUmOSm5IMJsbhIzRhk9nV9ieDfSvJBGFaFg+vBjF7Xut2/pAEKozR2lKCoCKKZwI9BOJMnlCd15e9vlQfNeUVARqfhyTrVJJzX3wJfB/KTiA1MPQRtogaANfeHgOtPxu2gQzdPFX5kbRXAMmIEQHxZ/zOPR52AEWJSKLwDU/McV101wKuGIiQr90rs2izlMuEywF7g+cXftUmMvaMDQWehRpMRpxlI8kZMwVwJ/pbt3wi3/sNFgoSnnzvHxXY8dF/WsqVLUxOec3Qrd7l96bCY3Pd3yc742Mk7PO+VLOMIB//k****​
    ​
    Valid Until:​
    Tue, 06 Dec 2022 10:45:50 GMT​
    ​
Share a directory within a bucket​
Use the following command to share objects in the file folder within the bucketname bucket.​
  • Command​
  • ​
    ./tosutil share-crt tos://bucketname/file/ ​
    ​
  • Output​
  • ​
    Authorization Code:​
    https://document-share.tos-cn-beijing.volces.com/index.html?token=/****+aY3yfy+JmQ2Yd144VAZ5FuFbHru0ADVaY5wZkCUQMZYifSKe5n1IL2WqrqLb/bzYMKl2lqdIZPG8dBL4XEXeKE9SqtS4n+f17aaSIBU3B288ly9ANNBJ7eaBCni7/UKKpK49ZfXxm0mCdbS9sFTNahK5IAesDvAqMQis7wTxRrrqSRG2zGgabYgTNbRWD2OklttTJPtSA4940kisfHOEQwWBZol7MVarJItDqVEeiT80wLa3pr+5gb/8ZtWrBBfCOjAkEJY7AUmOSm5AfYxAXhJzE8QbKWhGZiLCzxD7N7cXUZuwLJ5NrM7Q9X06OxXwYoBDrS35B+3DEkjPBqI1AM/H9AFj62jTj35j4r83p8bWsElBcCiut8Vvdw7QXWiICDyFnNcmYR7C5J/iYUXhh9uDH7pjfeZkbKkV5heNwTIoA2Q3GozRPv966ktNJRBw0zN++P8n9ER7aRV7MgsoevwBQQCeC/KA47lQ34nf6uMmGum2wVIe9b4PCPoAOrYPW8h0eKfhnmkHLJEhaKPhvZISBH+9BQriBln73ASwbDt92FWwOqNF/vOH8UsxCsLzUxPd686st0PSSs****​
    ​
    Valid Until:​
    Tue, 06 Dec 2022 10:47:17 GMT​
    ​
Share a directory within a bucket and specify where to save the authorization code​
Use the following command to share objects in the file folder within the bucketname bucket, and save the authorization code to /tmp/tosutil/authorization_code. The authorization code is valid for two hours.​
  • Command​
  • ​
    ./tosutil share-crt tos://bucketname/file/ -dst=/tmp/tosutil/authorization_code -vp=2h​
    ​
  • Output​
  • ​
    The result is generated to [/tmp/tosutil/authorization_code]​
    ​
Share an object​
Use the following command to share the object1.png object in the bucketname bucket.​
  • Command​
  • ​
    ./tosutil share-crt tos://bucketname/object1.png -em​
    ​
  • Output​
  • ​
    Authorization Code:​
    https://document-share.tos-cn-beijing.volces.com/index.html?token=/****+aY3yfy+JmQ2Yd144VAZ5FuFbHru0ADVaY5wZkCUQMZYifSKe5n1IL2WqrqLb/bzYMKl2lqdIZPG8dBL4XEXeKE9SqtS4n+f17aaSIBU3B288ly9ANNBJ7eaBCni7/UKKpK49ZfXxm0mCdbS9sFTNahK5IAesDvAqMQis7wTxRrrqSRG2zGgabYgTNbRWD2OklttTJPtSA4940kisfHOEQwWBZol7MVarJItDqVEeiT80wLa3pr+5gb/8ZtWrBBfCOjAkEJY7AUmOSm5DKH9vSYHHsx/NyPU4pOITmYALY8oDS2RmyGLwKV2MGv0dZSMViKFFVYn8M2mjXeadd1uvOFhXRjgj3jn1sJzyca9cgeCgH93dI6Tpa/DvZRdVY1IUhuCEX3ast2dhhsbSdzhmcV4PJ0jfxIvjdEGhYbp8wbfXVwJ028DBsvToRFpSIbr5fvYPAb2y7Wxp0AdXdUKXdWOtE2Ui9o+A8frSKcSAQxvW2EBLKoaL9GWQdrXhaYZtCLqd0TcOqr2d5GjuyJiMzqf9i5Wu98ydLsEYBiN8t1pbKOXuNMDbK/****​
    ​
    Valid Until:​
    Tue, 06 Dec 2022 10:48:12 GMT​
    ​
​
Last updated: 2025.12.17 18:33:45