[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:
``bash``
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:
``bash``
ls -la /tmp/test-permissions/
# Should show: drwxrws--- ... www-data ... parent
- Manually create a subdirectory to confirm inheritance works:
``bash``
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:
``bash``
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_
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗