Configuring a Bucket Policy
Function
You can use this command to configure a bucket policy.
Command Line Structure
- In Windows
obsutil bucketpolicy obs://bucket -method=put -localfile=xxx [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
- In Linux or macOS
./obsutil bucketpolicy obs://bucket -method=put -localfile=xxx [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
Examples
- Take the Windows OS as an example. Run the obsutil bucketpolicy obs://bucket -method=put -localfile=d:\temp\policy.json command to set a bucket policy based on file policy.json.
obsutil bucketpolicy obs://bucket -method=put -localfile=d:\temp\policy.json Start at 2024-09-30 07:59:28.8675681 +0000 UTC Put bucketPolicy succeed, requestId is [04050000016836C5DA6FB21F14A2A0C0]
Parameter Description
Parameter |
Optional or Mandatory |
Description |
---|---|---|
bucket |
Mandatory |
The bucket name |
method |
Mandatory |
The method. Set this parameter to put when configuring a bucket policy. |
localfile |
Mandatory |
The path of the local policy file to import |
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 |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.