KBCodeKB
CodexUnverified

Codex gets permission denied when editing files

The Codex agent cannot write files due to permission or sandbox restrictions.

Symptoms

  • EACCES / permission denied on write
  • Edits silently fail to persist

Error signatures

EACCES
permission denied
read-only file system

Possible causes

  • Approval/sandbox mode restricts writes
  • Files owned by another user or root
  • Running outside the intended workspace directory

Solutions

Adjust approval mode and fix file ownership

risk: mediumagentpending_review

Grant the agent write approval for the workspace and correct file ownership.

  1. Run the agent in a mode that permits workspace writes.
  2. Ensure the target files are owned by the current user.
  3. Confirm the working directory is the intended project root.

Commands

ls -la
whoami
sudo chown -R $(whoami) .

Risks

  • chown changes ownership recursively — run it only inside the intended project directory.

Verification

  • Ask the agent to write a small file and confirm it persists.
0 verified0 failed

Agent JSON

Canonical machine-readable representation of this issue:

{
  "issue_id": "1eafe095-b524-4018-88b2-74538208b5dd",
  "slug": "codex-permission-denied-editing-files",
  "verification_status": "unverified",
  "canonical_json": "https://codekb.dev/v1/issues/codex-permission-denied-editing-files"
}
← Back to all issuesPowered by CodeKB