Help Center/ Object Storage Service/ obsutil/ Object Commands/ Creating an Authorization Code for Directory Sharing
Updated on 2024-05-17 GMT+08:00

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 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:
    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:
  • If no access code is passed using this parameter, obsutil tool prompts you to enter the access code in interactive mode.
  • An access code is a six-digit string.

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:
  • This parameter supports different time units, including: m (month), w (week), d (day), h (hour), min (minute), and s (second). For example, 1d indicates that the authorization code is valid within one day, 2w indicates that the code is valid within two weeks, and 3h indicates that the code is valid within three hours.
  • The default time unit is s (second), for example, 3600 indicates that the authorization code is valid within 3600 seconds.

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