Creating an Authorization Code for Directory Sharing
Function
You can use this command to specify the bucket name, object name prefix, and access code to create an authorization code for directory sharing.
Command Line Structure
- In Windows
obsutil create-share obs://bucket[/prefix] [-ac=xxx] [-vp=xxx] [-dst=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
- In Linux OS or macOS
./obsutil create-share obs://bucket[/prefix] [-ac=xxx] [-vp=xxx] [-dst=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
Examples
- In Windows, you can run the obsutil create-share obs://bucket/test/ -ac=123456 -vp=1m command to create an authorization code that is valid within one month.
obsutil create-share obs://bucket/test/ -ac=123456 -vp=1m Authorization Code: https://e-share.obs-website.cn-north-4.myhuaweicloud.com? token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Access Code: 123456 Valid Until: Sat, 26 Oct 2019 11:28:10 GMT +8000
Parameter Description
| Parameter | Optional or Mandatory | Description |
|---|---|---|
| bucket | Mandatory | Name of a bucket |
| prefix | Optional | Prefix of an object name. If this parameter is specified, objects starting with this prefix are shared. If this parameter is left blank, all objects in the bucket are shared. NOTE: It is recommended that the value end with a slash (/). |
| ac | Optional (additional parameter) | Access code. NOTE:
|
| vp | Optional (additional parameter) | Validity period of an authorization code. The default value is one day, indicating that the generated authorization code is valid for only one day. NOTE:
|
| dst | Optional (additional parameter) | Path for storing the generated authorization code. |
| config | Optional (additional parameter) | User-defined configuration file for executing a command. For details about parameters that can be configured, see Parameter Description. |
| e | Optional (additional parameter) | Specifies the endpoint. |
| i | Optional (additional parameter) | Specifies the user's AK. |
| k | Optional (additional parameter) | Specifies the user's SK. |
| t | Optional (additional parameter) | Specifies the user's security token. |
Response
| Field | Description |
|---|---|
| Authorization Code | Code for authorization |
| Access Code | Access code |
| Valid Until | Expiration time |
Last Article: Deleting a Multipart Upload Task
Next Article: Listing Objects by Using an Authorization Code
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.