Is there a command using GSUTIL that will allow me to share publicly everything in a specific Bucket? Right now, I'm forced to go through and check "share publicly" individually on EVERY SINGLE FILE in the console.
Asked
Active
Viewed 296 times
2 Answers
5
The best way to do this is:
gsutil -m acl ch -u 'AllUsers:R' gs://your-bucket/**
will update ACLs for each existing object in the bucket.
If you want newly created objects in this bucket to also be public, you should also run:
gsutil defacl ch -u 'AllUsers:R' gs://your-bucket
This question was also asked here but the answer recommends using acl set public-read
which has the downside of potentially altering your existing ACLs.

Community
- 1
- 1

Travis Hobrla
- 5,411
- 23
- 22
0
$> gsutil acl ch -g All:R -r gs://bucketName
gsutil is the command-line utility for GCS.
"acl ch" means "Modify an ACL."
"-g All:R" means "include read permissions for all users."
"-r" means "recursively"
and the rest is the path.
If you have a whole lot of files and you want MORE SPEED, you can use -m to mean "and also do this multithreaded!", like so:
$> gsutil -m acl ch -g All:R -r gs://bucketName

Brandon Yarbrough
- 37,021
- 23
- 116
- 145
-
Thanks for the detailed explanation of the command line options involved! Cobbling all this together from Google's relatively opaque documentation is a pain! – Kirk Sefchik Mar 24 '16 at 14:47
-
If it helps in the future, the gsutil command line itself has pretty good documentation. For example, the command `gsutil help acl ch` will give you quite a bit of information on how to change ACLs, including a couple pages of examples. – Brandon Yarbrough Mar 24 '16 at 17:09
-
Yep! I looked at it! Unfortunately 99% of the cases and examples applied to strange access scenarios that don't apply to a simple website like I'm trying to host on there. Could I have figured this out? Sure. But it probably would have taken several hours of staring at the docs and possibly jacking up my site trying to get it to work. – Kirk Sefchik Mar 25 '16 at 11:49