Error: Permission Denied Troubleshooting Guide
Complete troubleshooting workflow for MCP filesystem Permission denied error, including file permission checks, directory settings, and OS-level permission solutions.
Error: Permission Denied Troubleshooting Guide
When using MCP filesystem tool and encountering "Permission denied" error, OS-level permissions are insufficient.
Causes
- Insufficient file permissions
- Insufficient directory permissions
- File locked by another process
- OS security policy restrictions
Troubleshooting Steps
Step 1: Check File Permissions
ls -la /path/to/file
Permission bits:
- Position 1: File type
- Positions 2-4: Owner (rwx)
- Positions 5-7: Group
- Positions 8-10: Others
Step 2: Check Directory Permissions
ls -ld /path/to/directory
Directories need execute (x) permission to enter.
Step 3: Fix File Permissions
# Add read permission
chmod u+r /path/to/file
# Add write permission
chmod u+w /path/to/file
# Standard permissions (644)
chmod 644 /path/to/file
Step 4: Fix Directory Permissions
# Set directory permissions (755)
chmod 755 /path/to/directory
# Recursive fix
chmod -R 755 /path/to/project
Step 5: Check File Locks
lsof | grep /path/to/file
kill -9 <PID>
Step 6: Check macOS Permissions
Full Disk Access:
- System Settings → Privacy & Security → Full Disk Access
- Ensure Claude Code has permission
Permission Reference
| Number | File | Directory |
|---|---|---|
| 644 | rw-r--r-- | - |
| 755 | rwxr-xr-x | rwxr-xr-x |
| 600 | rw------- | - |
| 777 | rwxrwxrwx | rwxrwxrwx |
FAQ
Q: Why still Permission denied after chmod?
A: Parent directory permissions, file locked, or need recursive fix.
Q: How to batch fix permissions?
A: Use find command:
find /path/to/project -type f -exec chmod 644 {} \;
find /path/to/project -type d -exec chmod 755 {} \;
Q: macOS "Operation not permitted"?
A: Grant Full Disk Access to Claude Code.
Verify Fix
- Check file permissions
- Check directory permissions
- Test reading file
- Restart Claude Code
Next Steps
FAQ
What does Permission denied mean?▼
Current user lacks permission to access file or directory.
How to fix directory permissions?▼
Use chmod 755 directory-path. Recursive: chmod -R 755 project-path.
What is the difference between chmod 644 and 755?▼
644 for files, 755 for directories.
Verification Records
人类专家验证
官方机器人验证