Sharing a File

Scenarios

You can allow other users to access a file stored in OBS by sharing the temporary URL of the file.

Background Information

File sharing is temporary. 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.cn-north-4.myhuaweicloud.com:443/image.png?AccessKeyId=xxx&Expires=xxx&response-content-disposition=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 more information about temporary authentication methods and parameters, see Authentication of Signature in a URL in OBS API Reference. A temporary URL also contains the response-content-disposition field, defining the method for accessing an object (download or preview in a web browser), which is determined by analyzing the Content-Type of the shared object.

After an object is shared on OBS Console, 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, which takes effect since the time when the validity period is changed.

Limitations and Constraints

  • An object shared from OBS Console can be valid for one minute to 18 hours. If you need a longer validity period for a shared object, use the client tool OBS Browser+ that allows a validity period of up to one year. If you want a shared object permanently valid, use a bucket policy to grant anonymous users public read permissions on the object by referring to Granting Public Read Permissions on Objects to Anonymous Users.
  • Only buckets of version 3.0 or later support the file sharing function. You can view the bucket version in the Basic Information area on the Overview page of a bucket.
  • To share an archived object, restore it first.

Procedure

  1. In the navigation pane on the left of OBS Console, choose Object Storage.
  2. In the bucket list, click a bucket name, and then the Overview page of the bucket is displayed.
  3. In the navigation pane on the left, click Objects.
  4. Locate the file to be shared and click Share under the Operation column. The dialog box as given in Figure 1 is displayed.

    Once the Share File dialog box is opened, the URL is effective and valid for five minutes by default. If you change the validity period, the authentication information in the URL changes accordingly, and the URL's new validity period starts upon the change.

    Figure 1 Sharing a file

  5. URL related operations

    • Click Open URL to preview the file on a new page or directly download it to your default download path.
    • Click Copy Link to share the link to other users, so that they can enter the link to a web browser to access the file.
    • Click Copy Path to share the file path to users who have access permissions to the bucket. Then the users can search for the file by pasting the path to the search box of the bucket.

    Within the validity period of a URL, any user who has the URL can access the file.