Google Certified Associate Cloud Engineer 2020

Sign Up Free or Log In to participate!

ServiceException: 401 Invalid Credentials when sharing an object inside the bucket.

When I want to share an object by running gsutil acl ...

botibagl@cloudshell:~ (services-exploration-278708)$ gsutil acl ch -u AllUsers:R gs://storage-lab-cli-2020-29thmay/DarkPoster-hires.png

ServiceException: 401 Invalid Credentials

botibagl@cloudshell:~ (services-exploration-278708)$

So at some point (not sure why) I lost my credential permissions during my cloud shell session (?)

Maybe because of some timeouts ?

That I did was authorize again access to gcloud by using my credentials https://cloud.google.com/sdk/gcloud/reference/auth/login

So I did the following:



botibagl@cloudshell:~ (services-exploration-278708)$ gcloud auth login

You are already authenticated with gcloud when running

inside the Cloud Shell and so do not need to run this

command. Do you wish to proceed anyway?

Do you want to continue (Y/n)? y

<span></span>

Go to the following link in your browser:

https://accounts.google.com/o/oauth2/auth?client_id=dsdsdsdsdsdsdsds_

Enter verification code: xxxxxxxxxxx

<span>```</span>

<span></span>

<span>  
</span>

<span>- And then I managed to share the file inside the bucket.</span>

<span></span>

<span>  
</span>

<span>```</span>

You are now logged in as [botibagl@gmail.com].

Your current project is [services-exploration-278708]. You can change this setting by running:

$ gcloud config set project PROJECT_ID

botibagl@cloudshell:~ (services-exploration-278708)$ gsutil acl ch -u AllUsers:R gs://storage-lab-cli-2020-29thmay/DarkPoster-hires.png

Updated ACL on gs://storage-lab-cli-2020-29thmay/DarkPoster-hires.png

botibagl@cloudshell:~ (services-exploration-278708)$

<span>```</span>

<span></span>

<span>  
</span>

<span>But something strange I noticed is why I did need to get permissions again from cloudshell if I already was authenticated? ... note that cloud shell itself told me that in the commands above.</span>
Bernardo Garcia Loaiza

Excuse me for the format question, I didn’t managed to use the markdown correctly.

0 Answers

Sign In
Welcome Back!

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

Get Started
Who’s going to be learning?