1
0
mirror of https://github.com/minio/docs.git synced 2025-07-28 19:42:10 +03:00
Files
docs/source/reference/minio-mc/mc-policy-set.rst
2022-01-05 15:16:22 -05:00

3.6 KiB

mc policy set

minio

Table of Contents

mc policy

mc policy set

Syntax

The mc policy set command sets anonymous (i.e. unauthenticated or public) access policies <minio-policy> for a bucket.

Buckets with anonymous policies allow clients to access the bucket contents and perform actions consistent with the specified policy without authentication <minio-authentication-and-identity-management>.

To set anonymous bucket policies using an IAM JSON policy <using-iam-policies>, use the mc policy set-json command.

EXAMPLE

The following command sets anonymous access policies for several buckets on the myminio MinIO deployment:

mc policy set upload myminio/uploads
mc policy set download myminio/downloads
mc policy set public myminio/public

Applications can perform the following operations without authentication:

  • PUT objects to myminio/uploads and myminio/public.
  • GET objects from myminio/downloads and myminio/public.

SYNTAX

The command has the following syntax:

mc [GLOBALFLAGS] policy set PERMISSION ALIAS

Parameters

PERMISSION

Required Name of the policy to assign to the specified ALIAS. Specify one of the following values:

  • none - Disable anonymous access to the ALIAS.
  • download - Enable download-only access to the ALIAS.
  • upload - Enable upload-only access to the ALIAS.
  • public - Enable download and upload access to the ALIAS.

ALIAS

Required The full path to the bucket or bucket prefix to which the command applies the specified ~mc policy set PERMISSION.

Specify the alias <alias> of the MinIO or other S3-compatible service and the full path to the bucket or bucket prefix. For example:

mc set public play/mybucket

Specify a bucket prefix to set the policy on only that prefix. For example, this command sets distinct anonymous bucket policies on the mybucket/downloads and mybucket/uploads prefixes:

mc set download play/mybucket/downloads
mc set upload play/mybucket/uploads

Global Flags

Examples

Set Anonymous Policy for Bucket

Use mc policy set to set the anonymous policy for a bucket:

mc policy set POLICY ALIAS/PATH
  • Replace POLICY <mc policy set PERMISSION> with a supported permission <mc policy set PERMISSION>.
  • Replace ALIAS <mc policy set ALIAS> with the alias <mc alias> of a configured S3-compatible host.
  • Replace PATH <mc policy set ALIAS> with the destination bucket.

Behavior

S3 Compatibility