gsutil ServiceException: 401 Anonymous caller does not have storage.objects.list access to bucket 即使我在 gcloud 中登录 [英] gsutil ServiceException: 401 Anonymous caller does not have storage.objects.list access to bucket even though I'm loggedin in gcloud

查看:33
本文介绍了gsutil ServiceException: 401 Anonymous caller does not have storage.objects.list access to bucket 即使我在 gcloud 中登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个内部应用程序来将文件上传到谷歌云.我不希望每个单独的用户或这个应用程序都登录,所以我使用的是服务帐户.我登录到服务帐户,一切正常,但是当我尝试上传时,它给了我这个错误:ServiceException: 401 Anonymous caller does not have storage.objects.list access to bucket

I am trying to create an internal app to upload files to google cloud. I don't want each individual user or this app to log in so I'm using a service account. I login into the service account and everything is ok, but when I try to upload it gives me this error: ServiceException: 401 Anonymous caller does not have storage.objects.list access to bucket

如您所见,我使用服务帐户登录,并且我的帐户(无论是服务还是个人)都可以使用

As you can see I am logged in with a service account and my account and(neither service or personal) works

推荐答案

我遇到了类似的问题,和往常一样,花了我 2 个小时,但解决方案是微不足道的,如果它只是写在某个地方......我需要登录除了被授权给 gcloud 之外(或者授权,什么适合你)给 gsutil.我以为他们是有联系的或其他什么,但不.在我运行 gsutil config 并通过提供的链接(以及我粘贴回控制台的代码)进行授权后,它开始为我工作.

I had similar problem, and as always, it took me 2 hours but the solution was trivial, if only it was written somewhere... I needed to login (or authorize, what suits you) to the gsutil in addition to being authorized to the gcloud. I thought they are linked or whatever, but nah. After I ran gsutil config and authorized via the provided link (and code that I pasted back to the console), it started working for me.

请注意,我还通过链接到我的项目的服务帐户登录到 gcloud,并在本地保存了服务帐户 .json 密钥(请参阅 gcloudauth activate-service-account --help).希望这可以帮助任何为此苦苦挣扎的人!

Note that I was also logged in to gcloud via a service account linked to my project and having the service account .json key saved locally (see gcloud auth activate-service-account --help). Hope this helps anyone struggling with this!

这篇关于gsutil ServiceException: 401 Anonymous caller does not have storage.objects.list access to bucket 即使我在 gcloud 中登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆