Updated on 2024-10-24 GMT+08:00

Sharing a Folder

Scenarios

You can share your folders in OBS with others.

Folder can be shared temporarily or permanently.

Background Information

  • Temporary sharing:

    Share a folder to other users through the temporary URL of the file. Folder sharing is temporary. All sharing URLs are only valid for a limited period of time.

    Folders can be temporarily shared by access code or URL:

    Sharing by access code

    You need to prepare a six-digit extraction code before sharing a folder. After the sharing task is created, OBS aggregates the download links of all objects in the folder to a static website that is hosted by a public OBS bucket. Then anyone who has the created temporary URL and access code can access the static website and download the shared files.

    A temporary URL consists of the access domain name and the temporary authentication information of a folder. Example:
    https://e-share.obs-website.ap-southeast-1.myhuaweicloud.com:443/image.png?token=xxx

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

    Sharing by URL

    You can specify a validity period and then share the generated link with others. Anyone can use a signature to access all objects in the shared folder.

    A temporary URL for accessing an object in a folder consists of a bucket domain name (prefix), an object path, and signature information (suffix).

  • 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.

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

    If access to an object using the URL fails, fix the problem by referring to Why Can't I Access an Object Through Its URL?

Limitations and Constraints

  • The following table describes the URL validity period of the folders that are temporarily shared in different ways.

    Way

    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.

    If you need a longer validity period, use OBS Browser+ that allows a validity period of up to one year to share the object. If you want a shared object to be permanently valid, use a bucket policy to grant anonymous users the public read permission for the folder.

    API

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

    OBS Browser+

    When you log in to OBS Browser+ using an account and password, a shared URL can be valid for 24 hours at most. The default validity period is 10 hours.

    If a longer validity period is required, use the permanent AK/SK for login.

    obsutil

    Use the additional parameter vp to specify how long an authorization code is valid. The default validity period is one day. The allowed units include m (months), w (weeks), d (days), h (hours), min (minutes), and s (seconds). If no time unit is specified, the value is calculated in seconds.

  • Folder sharing is restricted to a few regions only. For details about the supported regions, see Function Overview.
  • Only buckets of version 3.0 support folder sharing. For details about how to query the bucket version, see Checking OBS Version (OBS 2.0 or OBS 3.0).
  • Archive objects in a folder must be restored in the bucket before they can be downloaded.
  • Deep Archive objects in a folder must be restored in the bucket before they can be downloaded.

Ways to Share a Folder

You can use OBS Console, OBS Browser+, or obsutil to share a folder.