Using this command in my server from a php file:
exec(gsutil cp /path/to/file/on/server/namefile.ext gs://nameBucket/dir/namefile.ext > /dev/null 2>&1)
i got the namefile.ext on bucket, in the correct directory...but need to make this file public readable.
Already tried to put this command (at the end of file, for make that public) but nothing to do:
exec(gsutil iam ch allUsers:objectViewer gs://nameBucket/dir/namefile.ext > /dev/null 2>&1)
So, upload works but I need to make file readable without my interaction from "browser" of bucket. There is a way to do this? Maybe into cp command?
The gsutil iam ch allUsers:objectViewer
command you used is meant to make all objects in a bucket publicly readable, but you provided it with the url of the object.
So, if you want to make the specific file publicly readable:
gsutil acl ch -u AllUsers:R gs://nameBucket/dir/namefile.ext
If you want to make all objects in a bucket publicly readable:
gsutil iam ch allUsers:objectViewer gs://nameBucket/
This is documented here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With