Help Center/ Object Storage Service/ Tools Guide/ obsutil/ Object Commands/ Creating an Authorization Code for Directory Sharing
Updated on 2025-08-22 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

The bucket name

prefix

Optional

The 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)

The 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)

The 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)

The path for storing the generated authorization code

config

Optional (additional parameter)

The user-defined configuration file for executing the current command. To learn the parameters that can be configured in this file, see Configuration Parameters.

e

Optional (additional parameter)

The endpoint

i

Optional (additional parameter)

The user's AK

k

Optional (additional parameter)

The user's SK

t

Optional (additional parameter)

The user's security token

Response

Field

Description

Authorization Code

The code for authorization

Access Code

The access code

Valid Until

The expiration time