gsutil cors set command returns 403 AccessDeniedEx

2019-02-22 20:11发布

I'm following these instructions on how to set a CORS configuration on a Google Cloud Storage bucket and when I run the gsutil cors set command it returns the following error message:

AccessDeniedException: 403 The account for bucket "[REDACTED]" has been disabled.

For the record, I have access to the bucket. I have owner privileges for this project in the Developer Console. Running gsutil cp and gsutil ls work just fine.

Any ideas on what might be wrong here?

2条回答
爷的心禁止访问
2楼-- · 2019-02-22 20:54

I'm answering my question because I found the solution for this issue. I hope this helps anyone else who runs into this, because at the time there was little info on the web describing to how to solve this.

It turns out that my user account did not have "owner" access to the bucket. Here are the steps I took to grant myself access:

1) First, navigate to your project's Cloud Storage Browser in the Developer Console.

2) Once you see a listing of the buckets that are linked to your project, check the box next to the bucket(s) you'd like to modify the permissions for and then click the "Bucket Permissions" button.

step 2 image

3) Next, add your user account to the list of permitted users. Set the permission level to "owner". Click the "Save" button when you're done.

step 3 image

You should have access to the bucket now, which means you won't run into any 403 errors. If you are, you did not set the entity correctly or are using a different account when you authenticated with gsutil. Double-check your work and try again.

查看更多
来,给爷笑一个
3楼-- · 2019-02-22 20:54

Just providing another tip in case others find themselves in the same situation I did. Make sure to log in with the correct google account using gcloud auth login. This can be a tricky detail if there are multiple Google accounts.

查看更多
登录 后发表回答