Updated on 2023-08-01 GMT+08:00

Sharing Objects

Scenarios

You can share files with other users temporarily or permanently.

  • Temporary sharing:

    Share a file to other users through the temporary URL of the file. All shared URLs are temporary with a validity period.

    A temporary URL consists of the access domain name and the temporary authentication information of a file. Example:

    https://bucketname.obs.eu-west-101.dublincloud.cn:443/image.png?AccessKeyId=xxx&Expires=xxx&x-obs-security-token=xxx&Signature=xxx

    The temporary authentication information contains the AccessKeyId, Expires, x-obs-security-token, and Signature parameters. The AccessKeyId, x-obs-security-token, and Signature parameters are used for authentication. The Expires parameter specifies the validity period of the authentication.

    For details about the temporary authentication method and parameters, see Authentication of Signature in a URL in the Object Storage Service API Reference.

  • Permanent sharing:

    If you set the permission for an object to allow anonymous users to read it, anonymous users can access the object through the URL that you shared. For details about how to configure permissions, see Granting Public Read Permissions on Objects to Anonymous Users.

    The method of using a browser to access objects varies depending on the object type. You can directly open .txt and .html files using a browser. However, when you open .exe and .dat files using a browser, the files are automatically downloaded to your local computer.

    For details about how to obtain the object access URL, see How Do I Obtain the Access Path to an Object?

Constraints

  • Objects in the Archive storage class can be shared only after they have been restored.
  • An authorization code is not required for temporarily sharing a file.
  • Only buckets of version 3.0 or later support temporary file sharing. For details about how to query the bucket version, see Checking OBS Version (OBS 2.0 or OBS 3.0).
  • The following table describes the URL validity period of the files that are temporarily shared using different tools.

    Tool

    URL Validity Period

    OBS Console

    The URL is valid for 1 minute to 18 hours.

    After an object is shared, the system will generate a URL that contains the temporary authentication information, valid for five minutes since its generation by default. Each time you change the validity period of a URL, OBS obtains the authentication information again to generate a new URL for sharing. The new URL becomes valid at the moment the validity period is changed.

    API

    Configure parameter Expires to specify when a temporary authorization expires. The temporary authorization expires in 24 hours.

How to Use

You can use OBS Console, APIs, or obsutil to share files.

Related Operations

To download a generated temporary URL with wget, use "" and -O to specify the file name, or an error will occur.

Example:

[root@ecs-test ~]# wget "Temporary URL" -O abc

In the preceding command, abc indicates a new file name.