Google Certified Associate Cloud Engineer 2020

Sign Up Free or Log In to participate!

how do u remove public access to a bucket from cli

how do u remove the public access to an object in a  bucket from cli

1 Answers

You could try something like this to remove public access at the bucket level:

gsutil iam ch -d allUsers:objectViewer gs://bucket-name

You can get more examples with: 

gsutil help iam

Gerardo Narvaja

You can use gsutil iam get gs://bucket-namee/filename.txt. That will return a JSON object with the access information for that object. Then you could use that information with a gsutil iam set or gsutil iam ch to modify it. Example: gsutil iam ch -d allUsers gs://bucket-name/filename.txt to remove public access for the particular object. (apologies for the formatting)

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?