Google cloud storage Can';尽管I';我是老板

Google cloud storage Can';尽管I';我是老板,google-cloud-storage,gsutil,Google Cloud Storage,Gsutil,我试图对一个bucket和资源进行操作,但我不断地得到拒绝访问的错误 e、 g ``` $gsutil ls-L gs://images/large gs://images/large/aa.png: Creation time: Tue, 25 Nov 2014 20:03:19 GMT Cache-Control: public, max-age=2592000 Content-Length: 343034 Content-Type:

我试图对一个bucket和资源进行操作,但我不断地得到拒绝访问的错误

e、 g

```

$gsutil ls-L gs://images/large

gs://images/large/aa.png:
   Creation time:       Tue, 25 Nov 2014 20:03:19 GMT
   Cache-Control:       public, max-age=2592000
   Content-Length:      343034
   Content-Type:        image/png
   Generation:      1416945799570000
   Metageneration:      2
   ACL:     ACCESS DENIED. Note: you need OWNER permission
            on the object to read its ACL.
```


当我尝试运行acl操作或重写文件时也是如此。

首先,我想指出的是,作为bucket所有者意味着您始终可以删除存储在该bucket中的对象,但如果覆盖了默认acl,则您可能没有对象所有者权限。这与流行操作系统的工作方式不同,后者有超级用户的概念

您是否尝试使用API&auth->Credentials的开发者控制台中列出的项目中的现有命令运行该命令

如果您仍然收到该错误,则该对象可能是通过App Engine上传的。您可以使用以下代码在中创建应用程序引擎应用程序,这是因为应用程序引擎有自己的服务帐户(
@appspot.gserviceaccount.com
),并且它与开发者控制台中显示的不同

#!/usr/bin/env python                                                                                                                     
import webapp2
from google.appengine.api import app_identity
from google.appengine.api import urlfetch


class MainPage(webapp2.RequestHandler):
    def get(self):
        scope = "https://www.googleapis.com/auth/devstorage.full_control"
        authorization_token, _ = app_identity.get_access_token(scope)
        acls = urlfetch.fetch(
            "https://www.googleapis.com/storage/v1/b/<bucket>/o/<object/acl",
            method=urlfetch.GET,
            headers = {"Content-Type": "application/json", "Authorization": "OAuth " + authorization_token})
        self.response.headers['Content-Type'] = 'application/json'
        self.response.write(acls.content)

application = webapp2.WSGIApplication([
    ('/', MainPage),
], debug=True)
#/usr/bin/env python
导入webapp2
从google.appengine.api导入应用程序_identity
从google.appengine.api导入urlfetch
类主页(webapp2.RequestHandler):
def get(自我):
范围=”https://www.googleapis.com/auth/devstorage.full_control"
授权\令牌,\=应用\标识。获取\访问\令牌(作用域)
acls=urlfetch.fetch(

"https://www.googleapis.com/storage/v1/b//o/How 对象是否已写入?bucket上是否设置了默认的obect ACL?您可以使用
gsutil defacl get gs://bucketname