AccessDeniedException when trying to delete a file from Google Cloud Storage despite having Storage Admin role - Stack Overflow

I am facing an AccessDeniedException (403 Access Denied) when trying to delete a file from a Google Clo

I am facing an AccessDeniedException (403 Access Denied) when trying to delete a file from a Google Cloud Storage bucket. I have assigned the necessary permissions and roles (Storage Admin), but I still can't remove the object.

Steps taken:

IAM Permissions:

The service account has been granted the roles/storage.objectAdmin role on the bucket. My account has both Editor and Storage Admin roles in the project.

Bucket Policy Only:

I checked the bucket's settings and found that Bucket Policy Only is enabled. The Bucket Policy Only feature is locked until a specific future date.

Attempts to Remove the Object:

I attempted to remove a file from the bucket using the gsutil rm command. I received the error: AccessDeniedException: 403 Access denied.

Verification:

I have verified that no retention policy is set, and there is no object lock. I tried disabling Bucket Policy Only using the gcloud command but encountered errors because the option to disable was not recognized.

Current IAM Policy for the Bucket:

 - members:
 - projectEditor:project-id
 - projectOwner:project-id
  role: roles/storage.legacyBucketOwner
 - members:
 - projectViewer:project-id
  role: roles/storage.legacyBucketReader
 - members:
 - projectEditor:project-id
 - projectOwner:project-id
  role: roles/storage.legacyObjectOwner
 - members:
 - projectViewer:project-id
  role: roles/storage.legacyObjectReader
 - members:
 - serviceAccount:service-account-id
  role: roles/storage.objectAdmin

What I have tried:

  • Adding the storage.objectAdmin role to the service account.

  • Disabling Bucket Policy Only using the gcloud command, but it does not recognize the option.

  • Checking the bucket's permissions and object lock status.

Error Message:

gsutil rm gs://bucket-name/file-name
Removing gs://bucket-name/file-name...
AccessDeniedException: 403 Access denied.

I am facing an AccessDeniedException (403 Access Denied) when trying to delete a file from a Google Cloud Storage bucket. I have assigned the necessary permissions and roles (Storage Admin), but I still can't remove the object.

Steps taken:

IAM Permissions:

The service account has been granted the roles/storage.objectAdmin role on the bucket. My account has both Editor and Storage Admin roles in the project.

Bucket Policy Only:

I checked the bucket's settings and found that Bucket Policy Only is enabled. The Bucket Policy Only feature is locked until a specific future date.

Attempts to Remove the Object:

I attempted to remove a file from the bucket using the gsutil rm command. I received the error: AccessDeniedException: 403 Access denied.

Verification:

I have verified that no retention policy is set, and there is no object lock. I tried disabling Bucket Policy Only using the gcloud command but encountered errors because the option to disable was not recognized.

Current IAM Policy for the Bucket:

 - members:
 - projectEditor:project-id
 - projectOwner:project-id
  role: roles/storage.legacyBucketOwner
 - members:
 - projectViewer:project-id
  role: roles/storage.legacyBucketReader
 - members:
 - projectEditor:project-id
 - projectOwner:project-id
  role: roles/storage.legacyObjectOwner
 - members:
 - projectViewer:project-id
  role: roles/storage.legacyObjectReader
 - members:
 - serviceAccount:service-account-id
  role: roles/storage.objectAdmin

What I have tried:

  • Adding the storage.objectAdmin role to the service account.

  • Disabling Bucket Policy Only using the gcloud command, but it does not recognize the option.

  • Checking the bucket's permissions and object lock status.

Error Message:

gsutil rm gs://bucket-name/file-name
Removing gs://bucket-name/file-name...
AccessDeniedException: 403 Access denied.

Share Improve this question edited Nov 16, 2024 at 19:41 Doug Stevenson 319k36 gold badges456 silver badges473 bronze badges asked Nov 16, 2024 at 19:39 AdhilAdhil 238 bronze badges 1
  • Disabling Bucket Policy Only using the gcloud command, but it does not recognize the option. What do you mean with "it does not recognize the option"? What option? could you share the output? Also, what is the account executing the gsutil rm command? – MrThompson Commented Nov 16, 2024 at 21:44
Add a comment  | 

1 Answer 1

Reset to default 0

As you did not mention it in your post: maybe you just fot to activate the service account?

gcloud auth activate-service-account [ACCOUNT] --key-file=KEY_FILE

also, make sure that you have correct permissions to impersonate the SA you want to use.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745650474a4638233.html

相关推荐

  • Windows下配置Golang开发环境,并安装配置GoLand IDE

    作者:非妃是公主 专栏:《Golang》 博客地址:https:blog.csdnmyf_666 个性签:顺境不惰,逆境不馁

    1小时前
    00
  • 开发体育直播系统后台权限设计实践分享|ThinkPHP 技术栈落地案例

    今天我们分享的是一套由 东莞梦幻网络科技 自研的体育直播源码,在 ThinkPHP + MySQL 技术栈的加持下,后台权限系统如何从0到1落地,并支撑整个平台稳定运行。一、整体架构设计代码语言:html复制用户端(APPH5P

    1小时前
    20
  • 怎么用html写出哆啦A梦?

    用HTML和CSS来画哆啦A梦(Doraemon)是一项有趣且具有挑战性的任务。虽然HTML和CSS主要用于网页布局和样式,但通过巧妙的组合和定位,可以创建出相对简单的图形和图案。下面是一个简单的示例,展示了如何用HTML和CSS绘制哆啦A

    1小时前
    00
  • 流固耦合:基本概念、适用软件及 Abaqus 与 Powerflow 的协同仿真

    在工程和科学研究的诸多领域,流固耦合现象广泛存在且对系统性能有着关键影响。理解流固耦合的本质及其应用,对于优化设计、保障安全运行意义重大。同时,借助专业的流固耦合软件,能够更高效地对相关问题进行分析与模拟。接下来,让我们深入探究流固耦合的奥

    1小时前
    00
  • AI驱动的幼儿跌倒检测——视频安全系统的技术解析

    幼儿跌倒检测系统利用AI视频技术,结合人体姿态识别和实时报警功能,提供了一种智能化解决方案。本文将深入剖析其技术架构、模块实现与应用场景,探讨开源技术如何提升幼儿园安全管理。技术架构与实现项目背景幼儿在活动区域(如教室、操场)易发生跌倒,需

    1小时前
    00
  • 打破常规!支付宝小程序地图功能开发实用技巧,拓展业务场景

    打破常规!支付宝小程序地图功能开发实用技巧,拓展业务场景嘿,各位开发者小伙伴们

    1小时前
    00
  • 文章降 AI 痕迹方法与工具速览

    文章降AI的方法和工具汇总‌如下: 这几天又认真研究类了一下,想让 AI 生成的文章更自然,摆脱程式化痕迹,可尝试以下方法。借助 GPT、文字滚筒鸭,朱雀大模型检测器、豆包、kimi 等大模型,输入文本后,它们能通过调整结构、替换同义词等操

    1小时前
    00
  • 用安信可Ai

    以下作品由安信可社区用户业余菜狗制作前言自从接触智能家居之后,笔者就变得很依赖智能家居(绝对不是懒!)比如卧室灯,就在进门的地方,进门开灯很方便,但是晚上睡觉关灯就很不方便。之前是买了一款Wi-Fi灯,是用手机APP操作,刚开始用的时候感觉

    1小时前
    00
  • 群体遗传三剑客第三篇:megacc和ggtree进化树分析

    大家好,我是邓飞。之前计划写群体结构三剑客的博文,写了两篇了:搞起来!群体遗传三剑客:PCA、Admixture、进化树群体遗传三剑客第一篇:分组和不分组的PCA分析,添加解释百分比群体遗传三剑客第二篇:Admixture群体结构分析今天介

    1小时前
    00
  • Oracle linux 8 二进制安装 MySQL 8.4企业版

    使用命令ldd --version ldd 检查,确定MySQL 8二进制包版本代码语言:javascript代码运行次数:0运行复制[root@mysql8_3 ~]# ldd --version ldd安装libaio代码语言:java

    1小时前
    00
  • AI生态暗战升级,科技巨头铁幕下的终极博弈

    一场围绕AI与智能体的标准、协议及生态的暗战已然蓄势待发。在美剧《权力的游戏》中,不到终局,主角归属始终成谜。如今的AI行业,正上演着同样扣人心弦的戏码。这并非是传统意义上的军事或政治博弈,而是一场围绕AI与智能体的标准、协议及生态展开的暗

    1小时前
    00
  • 电脑分区后进不了系统怎么办,修复教程

    电脑分区后进不了系统,可能的原因有多种,包括分区操作不当导致系统文件丢失或损坏、BIOS设置错误、引导文件未正确配置等。针对这些问题,可以尝试以下解决方法&#xff1

    1小时前
    00
  • 计算机开机长鸣报警,电脑开机报警,详细教您电脑开机一直长鸣报警怎么办

    朋友们在使用电脑的过程中,经常会碰到开机一声长鸣,然后一直响个不停,这到底是怎么回事呢? 其实这个现象的产生一般是因为内存的问题,那用户遇到电脑开机一直

    1小时前
    00
  • 取消Win10开机系统选择倒计时,让电脑秒进系统

    取消Win10开机系统选择倒计时,让电脑秒进系统 近期,不少Win10用户反映在开机时会遇到一个选择系统的倒计时画面,这在一定程度上延缓了开机进程。对于追求高效启动体验的用户来说,这无疑是一个不必要的步骤。那么,如何取消这个倒计时,让电脑

    59分钟前
    00
  • 电脑密码在哪里设置win11,win11电脑开机密码怎么设置

    Win11系统由于许多设置和以前系统不一样了,所以很多用户们操作非常不习惯,有很多的小伙伴不知道win11系统怎么设置开机密码。给电脑设置密码,只有自己能打开进入系统桌面&a

    49分钟前
    00
  • 如何打造高效AI智能体?

    作者|Barry Zhang, Anthropic地址|出品|码个蛋(ID:codeegg)整理|陈宇明最近看到了 Anthropic 那篇著名的《Building effective agents》作者之一 Barry Zhang 在 2

    39分钟前
    00
  • Prometheus配置docker采集器

    Prometheus 配置 Docker 采集器Prometheus 是一个开源的监控系统和时间序列数据库,广泛用于容器化环境中。通过监控 Docker 容器,用户可以实时获取服务性能、资源使用情况等信息。本文将介绍如何为 Docker 容

    26分钟前
    00
  • Power BI 无公式实现帕累托图表

    帕累托分析(Pareto Analysis),也被称为8020法则、关键少数法则,是一种常用的管理工具,用于识别和处理影响业务的主要因素。看到李伟坚老师在Excel使用Vega实现了花式帕累托(参考:Excel 零公式实现高级帕累托图表)

    21分钟前
    00
  • Go 语言 Mock 实践

    Mock 是软件测试中的一项关键技术,尤其在单元测试领域,可谓是“顶梁柱”般的存在,几乎不可或缺。它通过模拟真实对象的行为,使我们能在不依赖外部系统的情况下,专注测试代码的核心逻辑。对于测试开发、自动化测试,乃至性能测试中的某些场景,合理使

    19分钟前
    00
  • 重装系统只影响C盘吗?深入解析系统重装的全过程

    重装系统只影响C盘吗?深入解析系统重装的全过程 在计算机的日常使用中,重装系统是一个常见的操作,尤其是在系统出现故障、感染病毒或需要优化系统性能时。然而,许多用户对于重装系统的具体过程和影响存在误解,认为重装系统仅仅是对C盘进行清空和重置

    5分钟前
    00

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信