For most of you is probably clear that if you install an AI application locally on your computer – such as Claude Code or Codex, that application gains read and WRITE access to everything your own user account can access.
No matter that I told Claude long time ago not to write a letter without my explicit permission, I’m not comfortable with this at all, and I don’t believe it’s appropriate. And no matter how useful such an application might be and is, I find it concerning that they are becoming increasingly intrusive and autonomous in their decision-making.
So when launched from a specific folder for the first time, Claude asks whether I trust that folder and raises warning that he will be able to read, write, and execute files. But, in practice, this means nothing! I might say I trust the folder – it’s my own after all and grant the application permissions to operate there because that’s the idea. But that is precisely the catch:
Nothing has ever prevented him from reading or writing anywhere across the entire file system accessible to my user account. In other words, the question of whether I “trust the folder” has absolutely nothing to do with the actual permissions granted to Claude.
After realizing this, we had a chat about it and I explored two available options (or combination of them both):
- Creating a separate user account exclusively for Claude.
- Implementing global and project based rules.
Personally, I opted to create a separate user account, as I trust more the operating system’s access controls than I do in the AI’s ability to adhere to its own rules. Furthermore, there is no guarantee that someone couldn’t hack the tool and force it to bypass such restrictions. Alternatively, the option of using rules to impose restrictions is faster and easier:
1. Edit ~/.claude/settings.json (located in the home directory on Linux and probably the same applies to other operating systems) and add rules, since there are none by default:
...
"permissions": {
"blockReadsOutsideWorkingDirectories": true,
"blockWritesOutsideWorkingDirectories": true
},
"sandbox": {
"enabled": true,
"allowUnsandboxedCommands": false,
"failIfUnavailable": true
}
2. Then, within the project folder, create a .claude/settings.local.json file to grant access only to the necessary directories:
{
"permissions": {
"additionalDirectories": [
"/absolute/path/to/project-folder"
]
},
"sandbox": {
"filesystem": {
"denyRead": ["/home/user"],
"allowRead": [
"/absolute/path/to/project-folder",
"/absolute/path/to/another-folder",
"/absolute/path/to/third-folder"
]
}
}
}
Hope that’s useful. As the old NFS saying goes:
“On the streets, drive safely and responsibly and wear your seatbelt”