File Deleted
View Diff
1> ## Documentation Index
2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt
3> Use this file to discover all available pages before exploring further.
4
5# Identity and Access Management
6
7> Learn how to configure user authentication, authorization, and access controls for Claude Code in your organization.
8
9## Authentication methods
10
11Setting up Claude Code requires access to Anthropic models. For teams, you can set up Claude Code access in one of these ways:
12
13* [Claude for Teams or Enterprise](/en/setup#for-teams-and-organizations) (recommended)
14* [Claude Console with team billing](/en/setup#for-teams-and-organizations)
15* [Amazon Bedrock](/en/amazon-bedrock)
16* [Google Vertex AI](/en/google-vertex-ai)
17* [Microsoft Foundry](/en/microsoft-foundry)
18
19### Claude for Teams or Enterprise (recommended)
20
21[Claude for Teams](https://claude.com/pricing#team-&-enterprise) and [Claude for Enterprise](https://anthropic.com/contact-sales) provide the best experience for organizations using Claude Code. Team members get access to both Claude Code and Claude on the web with centralized billing and team management.
22
23* **Claude for Teams**: Self-service plan with collaboration features, admin tools, and billing management. Best for smaller teams.
24* **Claude for Enterprise**: Adds SSO, domain capture, role-based permissions, compliance API, and managed policy settings for organization-wide Claude Code configurations. Best for larger organizations with security and compliance requirements.
25
26**To set up Claude Code access:**
27
281. Subscribe to [Claude for Teams](https://claude.com/pricing#team-&-enterprise) or contact sales for [Claude for Enterprise](https://anthropic.com/contact-sales)
292. Invite team members from the admin dashboard
303. Team members install Claude Code and log in with their Claude.ai accounts
31
32### Claude Console authentication
33
34For organizations that prefer API-based billing, you can set up access through the Claude Console.
35
36**To set up Claude Code access for your team via Claude Console:**
37
381. Use your existing Claude Console account or create a new Claude Console account
392. You can add users through either method below:
40 * Bulk invite users from within the Console (Console -> Settings -> Members -> Invite)
41 * [Set up SSO](https://support.claude.com/en/articles/13132885-setting-up-single-sign-on-sso)
423. When inviting users, they need one of the following roles:
43 * "Claude Code" role means users can only create Claude Code API keys
44 * "Developer" role means users can create any kind of API key
454. Each invited user needs to complete these steps:
46 * Accept the Console invite
47 * [Check system requirements](/en/setup#system-requirements)
48 * [Install Claude Code](/en/setup#installation)
49 * Login with Console account credentials
50
51### Cloud provider authentication
52
53**To set up Claude Code access for your team via Bedrock, Vertex, or Azure:**
54
551. Follow the [Bedrock docs](/en/amazon-bedrock), [Vertex docs](/en/google-vertex-ai), or [Microsoft Foundry docs](/en/microsoft-foundry)
562. Distribute the environment variables and instructions for generating cloud credentials to your users. Read more about how to [manage configuration here](/en/settings).
573. Users can [install Claude Code](/en/setup#installation)
58
59## Access control and permissions
60
61We support fine-grained permissions so that you're able to specify exactly what the agent is allowed to do (e.g. run tests, run linter) and what it is not allowed to do (e.g. update cloud infrastructure). These permission settings can be checked into version control and distributed to all developers in your organization, as well as customized by individual developers.
62
63### Permission system
64
65Claude Code uses a tiered permission system to balance power and safety:
66
67| Tool Type | Example | Approval Required | "Yes, don't ask again" Behavior |
68| :---------------- | :--------------- | :---------------- | :-------------------------------------------- |
69| Read-only | File reads, Grep | No | N/A |
70| Bash Commands | Shell execution | Yes | Permanently per project directory and command |
71| File Modification | Edit/write files | Yes | Until session end |
72
73### Configuring permissions
74
75You can view & manage Claude Code's tool permissions with `/permissions`. This UI lists all permission rules and the settings.json file they are sourced from.
76
77* **Allow** rules let Claude Code use the specified tool without manual approval.
78* **Ask** rules prompt for confirmation whenever Claude Code tries to use the specified tool.
79* **Deny** rules prevent Claude Code from using the specified tool.
80
81Rules are evaluated in order: **deny → ask → allow**. The first matching rule wins, so deny rules always take precedence.
82
83* **Additional directories** extend Claude's file access to directories beyond the initial working directory.
84* **Default mode** controls Claude's permission behavior when encountering new requests.
85
86Permission rules use the format: `Tool` or `Tool(optional-specifier)`
87
88A rule that is just the tool name matches any use of that tool. For example, adding `Bash` to the allow list allows Claude Code to use the Bash tool without requiring user approval. `Bash(*)` is equivalent to `Bash` and can be used interchangeably.
89
90<Note>
91 For a quick reference on permission rule syntax including wildcards, see [Permission rule syntax](/en/settings#permission-rule-syntax) in the settings documentation.
92</Note>
93
94#### Permission modes
95
96Claude Code supports several permission modes that can be set as the `defaultMode` in [settings files](/en/settings#settings-files):
97
98| Mode | Description |
99| :------------------ | :------------------------------------------------------------------------------------------------------------------------ |
100| `default` | Standard behavior - prompts for permission on first use of each tool |
101| `acceptEdits` | Automatically accepts file edit permissions for the session |
102| `plan` | Plan Mode - Claude can analyze but not modify files or execute commands |
103| `dontAsk` | Auto-denies tools unless pre-approved via `/permissions` or [`permissions.allow`](/en/settings#permission-settings) rules |
104| `bypassPermissions` | Skips all permission prompts (requires safe environment - see warning below) |
105
106#### Working directories
107
108By default, Claude has access to files in the directory where it was launched. You can extend this access:
109
110* **During startup**: Use `--add-dir <path>` CLI argument
111* **During session**: Use `/add-dir` command
112* **Persistent configuration**: Add to `additionalDirectories` in [settings files](/en/settings#settings-files)
113
114Files in additional directories follow the same permission rules as the original working directory - they become readable without prompts, and file editing permissions follow the current permission mode.
115
116#### Tool-specific permission rules
117
118Some tools support more fine-grained permission controls:
119
120**Bash**
121
122Bash permission rules support wildcard matching with `*`. Wildcards can appear at any position in the command, including at the beginning, middle, or end:
123
124* `Bash(npm run build)` Matches the exact Bash command `npm run build`
125* `Bash(npm run test *)` Matches Bash commands starting with `npm run test`
126* `Bash(npm *)` Matches any command starting with `npm ` (e.g., `npm install`, `npm run build`)
127* `Bash(* install)` Matches any command ending with ` install` (e.g., `npm install`, `yarn install`)
128* `Bash(git * main)` Matches commands like `git checkout main`, `git merge main`
129* `Bash(* --help *)` Matches any command with `--help` followed by additional arguments
130
131When `*` appears at the end with a space before it (like `Bash(ls *)`), it enforces a word boundary, requiring the prefix to be followed by a space or end-of-string. For example, `Bash(ls *)` matches `ls -la` but not `lsof`. In contrast, `Bash(ls*)` without a space matches both `ls -la` and `lsof` because there's no word boundary constraint. The legacy `:*` suffix syntax is equivalent to ` *` but is deprecated.
132
133<Tip>
134 Claude Code is aware of shell operators (like `&&`) so a prefix match rule like `Bash(safe-cmd *)` won't give it permission to run the command `safe-cmd && other-cmd`
135</Tip>
136
137<Warning>
138 Important limitations of Bash permission patterns:
139
140 1. The space before `*` matters: `Bash(ls *)` matches `ls -la` but not `lsof`, while `Bash(ls*)` matches both
141 2. The `*` wildcard can appear at any position and matches any sequence of characters
142 3. Patterns like `Bash(curl http://github.com/ *)` can be bypassed in many ways:
143 * Options before URL: `curl -X GET http://github.com/...` won't match
144 * Different protocol: `curl https://github.com/...` won't match
145 * Redirects: `curl -L http://bit.ly/xyz` (redirects to github)
146 * Variables: `URL=http://github.com && curl $URL` won't match
147 * Extra spaces: `curl http://github.com` won't match
148
149 For more reliable URL filtering, consider:
150
151 * **Restrict Bash network tools**: Use deny rules to block `curl`, `wget`, and similar commands, then use the WebFetch tool with `WebFetch(domain:github.com)` permission for allowed domains
152 * **Use PreToolUse hooks**: Implement a hook that validates URLs in Bash commands and blocks disallowed domains
153 * Instructing Claude Code about your allowed curl patterns via CLAUDE.md
154
155 Note that using WebFetch alone does not prevent network access. If Bash is allowed, Claude can still use `curl`, `wget`, or other tools to reach any URL.
156</Warning>
157
158**Read & Edit**
159
160`Edit` rules apply to all built-in tools that edit files. Claude will make a best-effort attempt to apply `Read` rules to all built-in tools that read files like Grep and Glob.
161
162Read & Edit rules both follow the [gitignore](https://git-scm.com/docs/gitignore) specification with four distinct pattern types:
163
164| Pattern | Meaning | Example | Matches |
165| ------------------ | -------------------------------------- | -------------------------------- | ---------------------------------- |
166| `//path` | **Absolute** path from filesystem root | `Read(//Users/alice/secrets/**)` | `/Users/alice/secrets/**` |
167| `~/path` | Path from **home** directory | `Read(~/Documents/*.pdf)` | `/Users/alice/Documents/*.pdf` |
168| `/path` | Path **relative to settings file** | `Edit(/src/**/*.ts)` | `<settings file path>/src/**/*.ts` |
169| `path` or `./path` | Path **relative to current directory** | `Read(*.env)` | `<cwd>/*.env` |
170
171<Warning>
172 A pattern like `/Users/alice/file` is NOT an absolute path - it's relative to your settings file! Use `//Users/alice/file` for absolute paths.
173</Warning>
174
175* `Edit(/docs/**)` - Edits in `<project>/docs/` (NOT `/docs/`!)
176* `Read(~/.zshrc)` - Reads your home directory's `.zshrc`
177* `Edit(//tmp/scratch.txt)` - Edits the absolute path `/tmp/scratch.txt`
178* `Read(src/**)` - Reads from `<current-directory>/src/`
179
180<Note>
181 In gitignore patterns, `*` matches files in a single directory while `**` matches recursively across directories. To allow all file access, use just the tool name without parentheses: `Read`, `Edit`, or `Write`.
182</Note>
183
184**WebFetch**
185
186* `WebFetch(domain:example.com)` Matches fetch requests to example.com
187
188**MCP**
189
190* `mcp__puppeteer` Matches any tool provided by the `puppeteer` server (name configured in Claude Code)
191* `mcp__puppeteer__*` Wildcard syntax that also matches all tools from the `puppeteer` server
192* `mcp__puppeteer__puppeteer_navigate` Matches the `puppeteer_navigate` tool provided by the `puppeteer` server
193
194**Task (Subagents)**
195
196Use `Task(AgentName)` rules to control which [subagents](/en/sub-agents) Claude can use:
197
198* `Task(Explore)` Matches the Explore subagent
199* `Task(Plan)` Matches the Plan subagent
200* `Task(Verify)` Matches the Verify subagent
201
202Add these rules to the `deny` array in your [settings](/en/settings#permission-settings) or use the `--disallowedTools` CLI flag to disable specific agents. For example, to disable the Explore agent:
203
204```json theme={null}
205{
206 "permissions": {
207 "deny": ["Task(Explore)"]
208 }
209}
210```
211
212### Additional permission control with hooks
213
214[Claude Code hooks](/en/hooks-guide) provide a way to register custom shell commands to perform permission evaluation at runtime. When Claude Code makes a tool call, PreToolUse hooks run before the permission system runs, and the hook output can determine whether to approve or deny the tool call in place of the permission system.
215
216### Managed settings
217
218For organizations that need centralized control over Claude Code configuration, administrators can deploy `managed-settings.json` files to [system directories](/en/settings#settings-files). These policy files follow the same format as regular settings files and cannot be overridden by user or project settings.
219
220### Settings precedence
221
222When multiple settings sources exist, they are applied in the following order (highest to lowest precedence):
223
2241. Managed settings (`managed-settings.json`)
2252. Command line arguments
2263. Local project settings (`.claude/settings.local.json`)
2274. Shared project settings (`.claude/settings.json`)
2285. User settings (`~/.claude/settings.json`)
229
230This hierarchy ensures that organizational policies are always enforced while still allowing flexibility at the project and user levels where appropriate.
231
232## Credential management
233
234Claude Code securely manages your authentication credentials:
235
236* **Storage location**: On macOS, API keys, OAuth tokens, and other credentials are stored in the encrypted macOS Keychain.
237* **Supported authentication types**: Claude.ai credentials, Claude API credentials, Azure Auth, Bedrock Auth, and Vertex Auth.
238* **Custom credential scripts**: The [`apiKeyHelper`](/en/settings#available-settings) setting can be configured to run a shell script that returns an API key.
239* **Refresh intervals**: By default, `apiKeyHelper` is called after 5 minutes or on HTTP 401 response. Set `CLAUDE_CODE_API_KEY_HELPER_TTL_MS` environment variable for custom refresh intervals.