gsutil ServiceException:401匿名调用者没有对存储桶的storage.objects.list访问权限,即使我已登录gcloud [英] gsutil ServiceException: 401 Anonymous caller does not have storage.objects.list access to bucket even though I'm loggedin in gcloud

查看:348
本文介绍了gsutil ServiceException:401匿名调用者没有对存储桶的storage.objects.list访问权限,即使我已登录gcloud的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个内部应用程序,以将文件上传到Google Cloud.我不希望每个用户或该应用程序都登录,所以我使用的是服务帐户.我登录到服务帐户,一切正常,但是当我尝试上传时,出现此错误:ServiceException:401个匿名调用者没有对bucket的storage.objects.list访问权限

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个小时,但解决方案却微不足道,如果只写在某个地方...我需要登录(或授权,适合您的情况)使用 gsutil 以及获得 gcloud 的授权.我以为他们有联系或其他什么,但是不.在运行 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匿名调用者没有对存储桶的storage.objects.list访问权限,即使我已登录gcloud的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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