列出 Google 云存储中的文件抛出:AccessDeniedException:403
List files in Google Cloud Storage throws: AccessDeniedException: 403
美好的一天,
我是 GCS 的新手,正在尝试使用 CLI 访问合作伙伴的存储桶。我已经使用 here 提供的文档安装了 gsutil(注意:我使用的是 macOS),现在我正在尝试列出存储桶中的文件。已提供访问 ID 密钥和密码,我使用它们来创建配置文件:
gsutil config -a
输出:
Boto config file "/path/to/.boto" created. If you need to
use a proxy to access the Internet please see the instructions in that
file.
但是,当我使用以下命令列出存储桶中的文件时:
gsutil ls gs://bucket-name
它说:
AccessDeniedException: 403 myemail@domain.com does not have storage.objects.list access to the Google Cloud Storage bucket.
我认为这可能是因为我在初始化 google 云时使用了以下登录:
gcloud init
我想知道是否有办法强制 ls
命令使用存储的凭据而不是我之前使用的电子邮件地址和登录名。非常感谢任何帮助。
你好,你可以试试 npm
试试 npm i @google-cloud/storage
I'm wondering if there is a way to force ls command to use stored credentials instead of my email address and login that I did earlier
创建一个具有必要权限的服务帐户(ex Storage Admin roles/storage.admin
)
运行 gsutil config -e
并插入私钥文件的完整路径
运行 gsutil ls
命令,gsutil 将使用服务帐户凭据。
这就是我在笔记本电脑上解决问题的方法。我先运行这个:
gcloud config set pass_credentials_to_gsutil false
然后 ls
命令就可以正常工作了。 st运行ge 对我来说是将 /
添加到我发布的原始 ls
命令中修复了另一个实例上的问题:
gsutil ls gs://bucket-name/
美好的一天,
我是 GCS 的新手,正在尝试使用 CLI 访问合作伙伴的存储桶。我已经使用 here 提供的文档安装了 gsutil(注意:我使用的是 macOS),现在我正在尝试列出存储桶中的文件。已提供访问 ID 密钥和密码,我使用它们来创建配置文件:
gsutil config -a
输出:
Boto config file "/path/to/.boto" created. If you need to
use a proxy to access the Internet please see the instructions in that
file.
但是,当我使用以下命令列出存储桶中的文件时:
gsutil ls gs://bucket-name
它说:
AccessDeniedException: 403 myemail@domain.com does not have storage.objects.list access to the Google Cloud Storage bucket.
我认为这可能是因为我在初始化 google 云时使用了以下登录:
gcloud init
我想知道是否有办法强制 ls
命令使用存储的凭据而不是我之前使用的电子邮件地址和登录名。非常感谢任何帮助。
你好,你可以试试 npm
试试 npm i @google-cloud/storage
I'm wondering if there is a way to force ls command to use stored credentials instead of my email address and login that I did earlier
创建一个具有必要权限的服务帐户(ex Storage Admin
roles/storage.admin
)运行
gsutil config -e
并插入私钥文件的完整路径运行
gsutil ls
命令,gsutil 将使用服务帐户凭据。
这就是我在笔记本电脑上解决问题的方法。我先运行这个:
gcloud config set pass_credentials_to_gsutil false
然后 ls
命令就可以正常工作了。 st运行ge 对我来说是将 /
添加到我发布的原始 ls
命令中修复了另一个实例上的问题:
gsutil ls gs://bucket-name/