Sharing a Folder
Application Scenario
You can share folders with other users temporarily or permanently.
- Temporary sharing:
Share a folder to other users through the temporary URL of the file. All shared URLs are temporary with a validity period.
You need to prepare a six-digit extraction code before sharing a folder. After the sharing link of the folder is created, OBS automatically aggregates the download links of all objects in the folder to a static website that is hosted by a public OBS bucket. Then users who have the temporary URL and extraction code can access the static website and download files.
A temporary URL consists of the access domain name and the temporary authentication information of a folder. 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 details about the temporary authentication method and parameters, see Authentication of Signature in a URL in Object Storage Service API Reference.
A temporary URL also contains the response-content-disposition parameter, which defines whether an object is directly downloaded or previewed in the web browser when it is accessed. The value is determined by the web browser based on the Content-Type of the shared object.
- 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 you failed to access an object, fix the problem according to Failed to Access an Object Through Its URL.
Constraints
- You need to restore an Archive object before sharing it to other users.
- The folder sharing function is restricted to a few regions only.
- Only buckets of version 3.0 or later support temporary folder 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 folders 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.
APIs
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 will 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.
How to Use This Function
You can use OBS Console, APIs, OBS Browser+, or obsutil to share folders.
| Tool | Reference |
|---|---|
| OBS Console | |
| APIs | |
| OBS Browser+ | - |
| obsutil |
Last Article: Sharing a File
Next Article: Managing Object Metadata
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.