All Products
Search
Document Center

Object Storage Service:get-bucket-policy-status

Last Updated:Mar 20, 2026

Check whether a bucket policy allows public access.

Prerequisites

By default, an Alibaba Cloud account has permission to query bucket policy configurations. To run this command as a RAM user or with Security Token Service (STS) credentials, grant the oss:GetBucketPolicyStatus permission. For more information, see Attach a custom policy to a RAM user.

Syntax

ossutil api get-bucket-policy-status --bucket <value> [flags]
ParameterTypeRequiredDescription
--bucketstringYesName of the bucket
This command corresponds to the GetBucketPolicyStatus API operation. For supported global flags, see Command-line options.

Examples

Check whether the bucket policy for examplebucket allows public access:

ossutil api get-bucket-policy-status --bucket examplebucket

Get the result in JSON format:

ossutil api get-bucket-policy-status --bucket examplebucket --output-format json

Get the result in YAML format:

ossutil api get-bucket-policy-status --bucket examplebucket --output-format yaml

Output

The response contains a single IsPublic field:

ValueMeaning
trueThe bucket policy allows public access
falseThe bucket policy does not allow public access

What's next