Difference between revisions of "Gsutil acl ch"

From wikieduonline
Jump to navigation Jump to search
Line 49: Line 49:
 
=== Ch Options ===
 
=== Ch Options ===
  
The "ch" sub-command has the following options
 
 
* <code>-d</code>
 
* <code>-d</code>
 
Remove all roles associated with the matching entity.
 
Remove all roles associated with the matching entity.

Revision as of 10:56, 1 August 2022

[1]

gsutil acl ch 

Ch Examples

  • gsutil acl ch -u AllUsers:R gs://example-bucket/example-object

Grant anyone on the internet WRITE access to the bucket example-bucket:

Grant the group OWNER access to all jpg files in example-bucket:

Remove access to the bucket example-bucket for the viewers of project number 12345:

  • gsutil acl ch -d viewers-12345 gs://example-bucket

Grant all users from the G Suite domain my-domain.org READ access to the bucket gcs.my-domain.org:

  • gsutil acl ch -g my-domain.org:R gs://gcs.my-domain.org

Remove any current access by [email protected] from the bucket example-bucket:

Ch Roles

You may specify the following roles with either their shorthand or their full name:

  • R: READ
  • W: WRITE
  • O: OWNER

Ch Entities

There are four different entity types: Users, Groups, All Authenticated Users, and All Users.

Users are added with -u and a plain ID or email address, as in "-u [email protected]:r". Note: Service Accounts are considered to be users.

Groups are like users, but specified with the -g flag, as in "-g [email protected]:O". Groups may also be specified as a full domain, as in "-g my-company.com:r".

AllAuthenticatedUsers and AllUsers are specified directly, as in "-g AllUsers:R" or "-g AllAuthenticatedUsers:O". These are case insensitive, and may be shortened to "all" and "allauth", respectively.

Removing roles is specified with the -d flag and an ID, email address, domain, or one of AllUsers or AllAuthenticatedUsers.

Many entities' roles can be specified on the same command line, allowing bundled changes to be executed in a single run. This will reduce the number of requests made to the server.

Ch Options

  • -d

Remove all roles associated with the matching entity.

  • -f

Normally gsutil stops at the first error. The -f option causes it to continue when it encounters errors. With this option the gsutil exit status will be 0 even if some ACLs couldn't be changed.

  • -g

Add or modify a group entity's role.

  • -p

Add or modify a project viewers/editors/owners role.

  • -R, -r

Performs acl ch request recursively, to all objects under the specified URL.

  • -u

Add or modify a user entity's role.

See also

  • https://cloud.google.com/storage/docs/gsutil/commands/acl
  • Advertising: