> For the complete documentation index, see [llms.txt](https://aws-gcr-wwso-security.gitbook.io/an-quan-zui-jia-shi-jian/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aws-gcr-wwso-security.gitbook.io/an-quan-zui-jia-shi-jian/1.-iam-shen-fen-shi-bie-yu-fang-wen-kong-zhi/privileged-access-management-te-quan-fang-wen-guan-li/shi-yong-scp-xian-zhi-gen-yong-hu-de-xing-wei.md).

# 使用SCP限制根用户的行为

1. 打开控制台的AWS Organizations。
2. 打开菜单AWS accounts，打开**Root**也就是最顶端的组织；
3. 在Policies页签下面，Service control policies，点击Attach；
4. 创建一个新的策略：Deny-Root-Actions，内容填写

```
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Deny-Root-Actions",
      "Effect": "Deny",
      "Action": [
        "*"
      ],
      "Resource": [
        "*"
      ],
      "Condition": {
        "ArnLike": {
          "aws:PrincipalArn": [
            "arn:aws:iam::*:root"
          ]
        }
      }
    }
  ]
}
```

也可以加上限制条件，比如有MFA的情况可以使用root，其他情况拒绝：

```
{
  "Version": "2012-10-17",
  "Statement": [
  {
    "Sid": "DenyAllForRootIfNoMFA",
    "Effect": "Deny",
    "Action": "*",
    "Resource": "*",
    "Condition": {
      "BoolIfExists": { "aws:MultiFactorAuthPresent": "false" },
      "StringLike": { "aws:PrincipalArn": ["arn:aws:iam::*:root"] }
    }
  }]
}
```

5. 绑定这个新创建的策略到Root上则完成通过SCP限制根用户的行为。

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://aws-gcr-wwso-security.gitbook.io/an-quan-zui-jia-shi-jian/1.-iam-shen-fen-shi-bie-yu-fang-wen-kong-zhi/privileged-access-management-te-quan-fang-wen-guan-li/shi-yong-scp-xian-zhi-gen-yong-hu-de-xing-wei.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
