[BUG] Write tool creates directories with incorrect permissions (doesn't inherit from parent)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
The Write tool creates new files and directories with default permissions (755 for directories, 644 for files) instead of inheriting permissions from the parent directory.
This seems to be a new problem. Ive made a point to make sure new files get the right permissions and this happens correctly if creating files with my IDE or any other tool. But Claude code has recently been creating files with specific permissions that do not work for my applications.
What Should Happen?
It should just create files with the defaults assigned by the file system.
When creating files/directories in a parent with specific permissions and setgid bit, the new files should inherit:
- The parent's group ownership (via setgid)
- Similar permission modes as sibling files/directories
- Any ACLs set on the parent directory
Error Messages/Logs
No errors, just the constant annoyance of having to fix permissions for every file and folder Claude code creates.
Steps to Reproduce
-
Create a test directory with setgid bit and restrictive permissions:
mkdir -p /tmp/test-permissions/parent chmod 2770 /tmp/test-permissions/parent chgrp www-data /tmp/test-permissions/parent -
Verify the parent directory has correct permissions:
ls -la /tmp/test-permissions/ # Should show: drwxrws--- ... www-data ... parent -
Manually create a subdirectory to confirm inheritance works:
mkdir /tmp/test-permissions/parent/manual-dir ls -la /tmp/test-permissions/parent/ # Should show: drwxrws--- ... www-data ... manual-dir (inherits correctly) -
Ask Claude Code to create a file in the parent directory:
"Please create a file at /tmp/test-permissions/parent/test.txt with the content 'test'" -
Ask Claude Code to create a directory:
"Please create a directory at /tmp/test-permissions/parent/claude-dir/" -
Check the permissions of files created by Claude:
ls -la /tmp/test-permissions/parent/ # Claude-created file shows: -rw-r--r-- (644 - wrong, should be 660) # Claude-created dir shows: drwxr-xr-x (755 - wrong, should be 2770)
Claude Model
Not sure / Multiple models
Is this a regression?
Yes, this worked in a previous version
Last Working Version
No response
Claude Code Version
2.0.45 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Jetbrains ide terminal.
Additional Information
No response
Why did the anthropic team not immediately rollback critically broken claude-code with such a catastrophic bug?
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Hi. This issue is still occurring with v2.0.76
This issue has been fixed in PR anthropics/claude-cli-internal#12383 (commit 80e16ef323).
The fix removes hardcoded permissions (0o600 for files, 0o700 for directories) and now respects the system umask for user-created files. With umask 022, files will now be created with 644 permissions (-rw-r--r--) instead of 600 (-rw-------).
The fix has been merged and will be available in the next release.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.